Skip to content

Instantly share code, notes, and snippets.

@ChunML
Created December 12, 2018 04:56
Show Gist options
  • Save ChunML/456cb0d65a5ed06799615611f0d0df21 to your computer and use it in GitHub Desktop.
Save ChunML/456cb0d65a5ed06799615611f0d0df21 to your computer and use it in GitHub Desktop.
def visualize_dataset(imgs, labels):
fig, axes = plt.subplots(ncols=4, nrows=4)
fig.set_size_inches(10, 10)
for i, img in enumerate(imgs):
img += means
np.clip(img, 0, 255, img)
img = img[0].astype(np.uint8)
img = Image.fromarray(img)
axes[int(i / 4), i % 4].imshow(img)
axes[int(i / 4), i % 4].axis('off')
axes[int(i / 4), i % 4].text(0, -10,
int_to_breed[labels[i]],
color='red',
fontsize=11)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment