Skip to content

Instantly share code, notes, and snippets.

View ksdkamesh99's full-sized avatar
💻
Sleep-Code-Eat

Kota Kamesh ksdkamesh99

💻
Sleep-Code-Eat
View GitHub Profile
imagegen=datagen.flow_from_directory(
directory,
target_size=(256, 256),
color_mode="rgb",
classes=None,
class_mode="categorical",
batch_size=32,
shuffle=True,
seed=None,
save_to_dir=None,
x=imagegen.next()
datagen=ImageDataGenerator()
imagegen=datagen.flow_from_directory('images/',batch_size=1)
x=imagegen.next()
plt.imshow(x[0][0].astype('uint8'))
plt.show()
datagen=ImageDataGenerator(
rotation_range=180
)
imagegen=datagen.flow_from_directory('images/',batch_size=1)
fig, rows =plt.subplots(nrows=1, ncols=4, figsize=(18,18))
for row in rows:
row.imshow(imagegen.next()[0][0].astype('uint8'))
plt.show()
datagen=ImageDataGenerator(
height_shift_range=0.25
#height_shift_range=[0,5,40,20]
)
imagegen=datagen.flow_from_directory('images/',batch_size=1)
fig, rows =plt.subplots(nrows=1, ncols=4, figsize=(18,18))
for row in rows:
row.imshow(imagegen.next()[0][0].astype('uint8'))
plt.show()
datagen=ImageDataGenerator(
width_shift_range=[-50,0,50,40,-30,60,70,80]
#width_shift_range=0.35
)
imagegen=datagen.flow_from_directory('images/',batch_size=1)
fig, rows =plt.subplots(nrows=1, ncols=4, figsize=(18,18))
for row in rows:
row.imshow(imagegen.next()[0][0].astype('uint8'))
plt.show()
datagen=ImageDataGenerator(
horizontal_flip=True
)
imagegen=datagen.flow_from_directory('images/',batch_size=1)
fig, rows =plt.subplots(nrows=1, ncols=4, figsize=(18,18))
for row in rows:
row.imshow(imagegen.next()[0][0].astype('uint8'))
plt.show()
datagen=ImageDataGenerator(
vertical_flip=True
)
imagegen=datagen.flow_from_directory('images/',batch_size=1)
fig, rows =plt.subplots(nrows=1, ncols=4, figsize=(18,18))
for row in rows:
row.imshow(imagegen.next()[0][0].astype('uint8'))
plt.show()
datagen=ImageDataGenerator(
shear_range=60
)
imagegen=datagen.flow_from_directory('images/',batch_size=1)
fig, rows =plt.subplots(nrows=1, ncols=4, figsize=(18,18))
for row in rows:
row.imshow(imagegen.next()[0][0].astype('uint8'))
plt.show()
datagen=ImageDataGenerator(
zoom_range=0.8
#zoom_range=[0.2,1.6]
)
imagegen=datagen.flow_from_directory('images/',batch_size=1)
fig, rows =plt.subplots(nrows=1, ncols=4, figsize=(18,18))
for row in rows:
row.imshow(imagegen.next()[0][0].astype('uint8'))
plt.show()