Exemplo n.º 1
0
def generate_train(x_train, y_train, mp_pool):
    # this is the augmentation configuration we will use for training
    train_datagen = T.ImageDataGenerator(
        featurewise_center=False,  # set input mean to 0 over the dataset
        samplewise_center=False,  # set each sample mean to 0
        featurewise_std_normalization=False,  # divide inputs by std of the dataset
        samplewise_std_normalization=False,  # divide each input by its std
        zca_whitening=False,  # apply ZCA whitening
        rotation_range=0,  # randomly rotate images in the range (degrees, 0 to 180)
        width_shift_range=0.2,  # randomly shift images horizontally (fraction of total width)
        height_shift_range=0.2,  # randomly shift images vertically (fraction of total height)
        horizontal_flip=True,  # randomly flip images
        vertical_flip=False,  # randomly flip images
        zoom_range=[.8, 1],
        channel_shift_range=30,
        fill_mode='reflect')
    train_datagen.config['random_crop_size'] = (299, 299)
    train_datagen.set_pipeline([T.random_transform, T.random_crop, T.preprocess_input])
    return train_datagen.flow(x_train, y_train, batch_size=batch_size, seed=3, pool=mp_pool)
Exemplo n.º 2
0
def generate_test(x_test, y_test, mp_pool):
    test_datagen = T.ImageDataGenerator()
    test_datagen.config['random_crop_size'] = (299, 299)
    test_datagen.set_pipeline([T.random_transform, T.random_crop, T.preprocess_input])
    return test_datagen.flow(x_test, y_test, batch_size=batch_size, seed=11, pool=mp_pool)