-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathshow_images.py
More file actions
30 lines (23 loc) · 785 Bytes
/
show_images.py
File metadata and controls
30 lines (23 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from __future__ import print_function, division
from builtins import range, input
# Note: you may need to update your version of future
# sudo pip install -U future
import numpy as np
import matplotlib.pyplot as plt
from util import getData
label_map = ['Anger', 'Disgust', 'Fear', 'Happy', 'Sad', 'Surprise', 'Neutral']
def main():
X, Y, _, _ = getData(balance_ones=False)
while True:
for i in range(7):
x, y = X[Y==i], Y[Y==i]
N = len(y)
j = np.random.choice(N)
plt.imshow(x[j].reshape(48, 48), cmap='gray')
plt.title(label_map[y[j]])
plt.show()
prompt = input('Quit? Enter Y:\n')
if prompt.lower().startswith('y'):
break
if __name__ == '__main__':
main()