barisozmen / deepaugment

Discover augmentation strategies tailored for your dataset
MIT License
244 stars 41 forks source link

Unable to run with fashion_mnist #37

Open kaka1346 opened 3 years ago

kaka1346 commented 3 years ago

Hi,

Could you please explain about sample script that use fashion_mnist dataset As I know, fashion_mnist is gray dataset, how convert to to 3 channel images as requirement ?

below is code i used:

===== from keras.datasets import fashion_mnist from deepaugment.deepaugment import DeepAugment my_config = { "model": "basiccnn", "method": "bayesian_optimization", "train_set_size": 2000, "opt_samples": 3, "opt_last_n_epochs": 3, "opt_initial_points": 10, "child_epochs": 50, "child_first_train_epochs": 0, "child_batch_size": 64 } (x_train, y_train), (x_test, y_test) = fashion_mnist.load_data() X_train = x_train.reshape(x_train.shape[0], x_train.shape[1], x_train.shape[2], 1) deepaug = DeepAugment(images=X_train, labels=y_train, config=my_config) best_policies = deepaug.optimize(300)

I have tried to reshape X_train = x_train.reshape(x_train.shape[0], x_train.shape[1], x_train.shape[2], 3), but it cann't The error I faced

0, 0.1327777779367234, ['rotate', 0.0, 'rotate', 0.0, 'rotate', 0.0, 'rotate', 0.0, 'rotate', 0.0, 'rotate', 0.0, 'rotate', 0.0, 'rotate', 0.0, 'rotate', 0.0, 'rotate', 0.0] trial: 1 ['gamma-contrast', 0.8442657485810175, 'coarse-salt-pepper', 0.8472517387841256, 'brighten', 0.38438170729269994, 'translate-y', 0.056712977317443194, 'translate-y', 0.47766511732135, 'add-to-hue-and-saturation', 0.47997717237505744, 'emboss', 0.8360787635373778, 'sharpen', 0.6481718720511973, 'emboss', 0.9571551589530466, 'rotate', 0.8700872583584366] /home/kaka/PycharmProjects/DeepAugment /venv/lib/python3.6/site-packages/imgaug/augmenters/color.py:448: UserWarning: Received an image with shape (H, W, C) and C=1 in ChangeColorspace._augment_image(). Expected C to usually be 3 -- any other value will likely result in errors. (Note that this function is e.g. called during grayscale conversion and hue/saturation changes.) "changes.)" % (image.shape[2],)