forked from Sentdex/pygta5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
5. check_data.py
67 lines (54 loc) · 1.9 KB
/
5. check_data.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import numpy as np
import pandas as pd
from collections import Counter
from random import shuffle
import cv2
import os
import time
path = 'training18'
train_type = 'raw'
# Get address of current working directory
folder = os.path.join(os.getcwd(), 'training', path)
# Gets all contents of the address of folder
filenames = os.listdir(folder)
# ================================================================================
# train_data = np.load(os.path.join(folder, 'training7_data-13v1.npy'))
# # shuffle(train_data)
# print(train_data.shape)
# for data in train_data:
# img = data[0]
# choice = data[1]
# cv2.imshow('test', img)
# print(choice)
# if cv2.waitKey(25) & 0xFF == ord('q'):
# cv2.destroyAllWindows()
# break
# ================================================================================
count = 1
for filename in filenames:
try:
train_data = np.load(os.path.join(folder, '{}_{}-{}.npy'.format(path, train_type, count)))
except:
print('Something went wrong at', count)
break
print('='*80)
print(' '*80)
print('{}_{}-{}.npy'.format(path, train_type, count), train_data.shape)
# df = pd.DataFrame(train_data)
# print(df.head())
# print(Counter(df[1].apply(str)))
print(train_data.shape)
print(' '*80)
print('='*80)
time.sleep(3)
# for data in train_data:
# img = data[0]
# print(img.shape)
# choice = data[1]
# cv2.imshow('test', img)
# print(choice)
# if cv2.waitKey(25) & 0xFF == ord('q'):
# cv2.destroyAllWindows()
# break
count += 1
# ================================================================================