Last active
September 2, 2021 19:07
-
-
Save shyamal18122000/9a46fcba14af76485fb10535afa8b242 to your computer and use it in GitHub Desktop.
This file contains 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
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