Last active
August 7, 2020 18:32
-
-
Save aniruddha27/76183fea01820bca6f72ca17f87306bc 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
# ImageDataGenerator flow_from_directory | |
train_generator = datagen.flow_from_directory( | |
directory=home_path + r'/train/', | |
target_size=(400, 400), # resize to this size | |
color_mode="rgb", # for coloured images | |
batch_size=1, # number of images to extract from folder for every batch | |
class_mode="binary", # classes to predict | |
seed=2020 # to make the result reproducible | |
) | |
fig, ax = plt.subplots(nrows=1, ncols=4, figsize=(15,15)) | |
for i in range(4): | |
# convert to unsigned integers for plotting | |
image = next(train_generator)[0].astype('uint8') | |
# changing size from (1, 200, 200, 3) to (200, 200, 3) for plotting the image | |
image = np.squeeze(image) | |
# plot raw pixel data | |
ax[i].imshow(image) | |
ax[i].axis('off') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment