Skip to content

Instantly share code, notes, and snippets.

@shyamal18122000
Last active September 2, 2021 19:07
Show Gist options
  • Save shyamal18122000/9a46fcba14af76485fb10535afa8b242 to your computer and use it in GitHub Desktop.
Save shyamal18122000/9a46fcba14af76485fb10535afa8b242 to your computer and use it in GitHub Desktop.
os.mkdir('./images/')
alpha = 'a'
for i in range(0, 26):
os.mkdir('./images/' + alpha)
alpha = chr(ord(alpha) + 1)
for file in os.listdir(rootdir):
letter = file[0]
try:
shutil.copy(rootdir+file, './images/' + letter + '/' + file)
except :
print(file)
datagen = ImageDataGenerator(rotation_range=20,
shear_range=10,
validation_split=0.2)
train_generator = datagen.flow_from_directory('./images/',
target_size=(28,28),
subset='training')
val_generator = datagen.flow_from_directory('./images/',
target_size=(28,28),
subset='validation')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment