Skip to content

Instantly share code, notes, and snippets.

@jonathanoheix
Created January 4, 2019 08:25
Show Gist options
  • Save jonathanoheix/2f24750e6f3d798bd0e3ee0b4d1556ef to your computer and use it in GitHub Desktop.
Save jonathanoheix/2f24750e6f3d798bd0e3ee0b4d1556ef to your computer and use it in GitHub Desktop.
# display some images for every different expression
import numpy as np
import seaborn as sns
from keras.preprocessing.image import load_img, img_to_array
import matplotlib.pyplot as plt
import os
# size of the image: 48*48 pixels
pic_size = 48
# input path for the images
base_path = "../input/images/images/"
plt.figure(0, figsize=(12,20))
cpt = 0
for expression in os.listdir(base_path + "train/"):
for i in range(1,6):
cpt = cpt + 1
plt.subplot(7,5,cpt)
img = load_img(base_path + "train/" + expression + "/" +os.listdir(base_path + "train/" + expression)[i], target_size=(pic_size, pic_size))
plt.imshow(img, cmap="gray")
plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment