Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created August 17, 2019 13:25
Show Gist options
  • Save dipanjanS/7a8822e34ef55fcb5f451b4182e6cb46 to your computer and use it in GitHub Desktop.
Save dipanjanS/7a8822e34ef55fcb5f451b4182e6cb46 to your computer and use it in GitHub Desktop.
from keras.preprocessing.image import img_to_array, load_img
import glob
import matplotlib.pyplot as plt
%matplotlib inline
data_signal_files = glob.glob(TRAIN_DIR+'/*/*.png')
sample_files = [data_signal_files[idx] for idx in range(0, 5600, 800+15)]
fix, ax = plt.subplots(2, 4, figsize=(14, 6))
for idx, img in enumerate(sample_files):
id1 = 1 if idx > 3 else 0
id2 = idx % 4
img_arr = img_to_array(load_img(img))
f = ax[id1, id2].imshow(img_arr / 255., aspect='auto')
t = ax[id1, id2].set_title(img.split('/')[-1].split('.')[0].split('_')[-1], fontsize=10)
ax[1,3].set_axis_off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment