Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created August 21, 2019 15:50
Show Gist options
  • Save dipanjanS/52508ea7d3c442faf34570694d0307dc to your computer and use it in GitHub Desktop.
Save dipanjanS/52508ea7d3c442faf34570694d0307dc to your computer and use it in GitHub Desktop.
TEST_BATCH_SIZE = 1
IMG_DIMS = (192, 192)
test_generator = test_datagen.flow_from_directory(directory=TEST_DIR,
classes=['brightpixel', 'narrowband',
'narrowbanddrd', 'noise',
'squarepulsednarrowband', 'squiggle',
'squigglesquarepulsednarrowband'],
target_size=IMG_DIMS,
batch_size=TEST_BATCH_SIZE,
class_mode='categorical',
interpolation='bicubic',
shuffle=False, seed=42)
class_label_mapping = {v:k for k,v in test_generator.class_indices.items()}
test_data = [next(test_generator) for i in range(700)]
test_data_X = [data[0] for data in test_data]
test_data_X = np.array(np.squeeze(test_data_X, axis=0))
test_data_y = np.array([fname.split('/')[0] for fname in test_generator.filenames])
class_labels = list(set(test_data_y))
test_data_X.shape, test_data_y.shape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment