forked from Sentdex/pygta5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_viewer.py
49 lines (45 loc) · 1.83 KB
/
data_viewer.py
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
39
40
41
42
43
44
45
46
47
48
49
#https://youtu.be/wIxUp-37jVY?t=48
import numpy as np
import pandas as pd
from collections import Counter
from random import shuffle
import cv2
FILE_I_END = 2
data_order = [i for i in range(1, FILE_I_END + 1)]
for count, i in enumerate(data_order):
try:
file_name = 'D:/training_data/hist_data_2/hist_2_training_data-{}.npy'.format(i)
train_data = np.load(file_name, allow_pickle=True)
for data in train_data:
img = data[0]
choice = data[1]
if choice == [1, 0, 0, 0, 0, 0, 0, 0, 0]:
choice_img = 'key_images/w.png'
elif choice == [0, 1, 0, 0, 0, 0, 0, 0, 0]:
choice_img = 'key_images/s.png'
elif choice == [0, 0, 1, 0, 0, 0, 0, 0, 0]:
choice_img = 'key_images/a.png'
elif choice == [0, 0, 0, 1, 0, 0, 0, 0, 0]:
choice_img = 'key_images/d.png'
elif choice == [0, 0, 0, 0, 1, 0, 0, 0, 0]:
choice_img = 'key_images/aw.png'
elif choice == [0, 0, 0, 0, 0, 1, 0, 0, 0]:
choice_img = 'key_images/dw.png'
elif choice == [0, 0, 0, 0, 0, 0, 1, 0, 0]:
choice_img = 'key_images/as.png'
elif choice == [0, 0, 0, 0, 0, 0, 0, 1, 0]:
choice_img = 'key_images/ds.png'
elif choice == [0, 0, 0, 0, 0, 0, 0, 0, 1]:
choice_img = 'key_images/nk.png'
else:
print('no matches')
img2 = cv2.imread(choice_img)
img2 = cv2.resize(img2, (250, 270))
images_1_2_h = np.concatenate((img, img2), axis=1)
cv2.imshow('test', images_1_2_h)
print(choice)
if cv2.waitKey(25) & 0xFF == ord('q'):
cv2.destroyAllWindows()
break
except Exception as e:
print(str(e))