Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created August 17, 2019 13:59
Show Gist options
  • Save dipanjanS/aec5c55eb09183801b54ac8f7f0ef2cf to your computer and use it in GitHub Desktop.
Save dipanjanS/aec5c55eb09183801b54ac8f7f0ef2cf to your computer and use it in GitHub Desktop.
# building sample data generator
sample_generator = train_datagen.flow_from_directory(directory=TRAIN_DIR,
classes=['brightpixel', 'narrowband',
'narrowbanddrd', 'noise',
'squarepulsednarrowband', 'squiggle',
'squigglesquarepulsednarrowband'],
target_size=IMG_DIMS,
batch_size=1,
class_mode='categorical',
interpolation='bicubic',
shuffle=True, seed=42)
sample = [next(sample_generator) for i in range(0,5)]
# viewing sample signal data
fig, ax = plt.subplots(1,5, figsize=(16, 6))
print('Labels:', [list(item[1][0]) for item in sample])
l = [ax[i].imshow(sample[i][0][0]) for i in range(0,5)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment