Last active
June 12, 2018 10:22
-
-
Save visionNoob/09f8209c415f8de60a18760f74c5ca01 to your computer and use it in GitHub Desktop.
keras channel_shift_range example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keras | |
import numpy as np | |
from keras.preprocessing.image import ImageDataGenerator | |
#data | |
data = np.array([[0,0,0],[10,10,10],[100,100,100]]) | |
print(data) | |
#ImageDataGenerator | |
expand_data = np.expand_dims(data, axis = 0) | |
augmented_data = [] | |
datagen = ImageDataGenerator(channel_shift_range = 10) | |
for data in datagen.flow(np.expand_dims(expand_data, axis = 0)): | |
augmented_data.append(data) | |
break; | |
print(augmented_data[0]) | |
print(augmented_data[0][0] - expand_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment