forked from mark-g-y/SignLanguageLadderNetwork
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualize.py
More file actions
38 lines (32 loc) · 843 Bytes
/
Copy pathvisualize.py
File metadata and controls
38 lines (32 loc) · 843 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
31
32
33
34
35
36
37
38
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import csv
import random
import numpy as np
def parse_csv(filename):
f = open(filename)
linesr = f.readlines()
f.close()
total = 0
first = True
lines = []
labels = []
for line in linesr:
if first:
first = False
continue
line = line.strip().split(',')
line = np.array(map(lambda x: int(x), line))
labels.append(line[0])
lines.append(line[1:])
total += 1
if total >= 20000:
break
return np.array(lines), np.array(labels)
x_test, y_test = parse_csv('sign_mnist_test.csv')
for i in range(1000, len(y_test)):
if y_test[i] == 17:
plt.imshow(x_test[i].reshape((28, 28)), cmap="gray")
plt.savefig('R.png')
exit()