Skip to content

Instantly share code, notes, and snippets.

@visionNoob
Last active June 12, 2018 10:22
Show Gist options
  • Save visionNoob/09f8209c415f8de60a18760f74c5ca01 to your computer and use it in GitHub Desktop.
Save visionNoob/09f8209c415f8de60a18760f74c5ca01 to your computer and use it in GitHub Desktop.
keras channel_shift_range example
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