Browse Source

still working on balancing

James Jeon 2 years ago
parent
commit
ffeb604d0a
3 changed files with 67 additions and 6 deletions
  1. 60
    3
      balance_data.py
  2. 2
    0
      train.py
  3. 5
    3
      visualize_raw_data.py

+ 60
- 3
balance_data.py View File

@@ -1,10 +1,67 @@
1 1
 import os
2 2
 import numpy as np
3 3
 from random import shuffle
4
+# os.path.exists("/etc/password.txt")
5
+'''
4 6
 
5
-for i in range(-20,21):
6
-	string = "
7
-	data_set[string] = 0
7
+# amount of lists you want to create
8
+for i in range(0,16):
9
+	plus = "" # this line is here to clear out the previous command
10
+	plus = "plus" + str(i) + " = []"
11
+	minus = "" # this line is here to clear out the previous command
12
+	minus = "minus" + str(i) + " = []"
13
+	exec(plus)
14
+	exec(minus)
15
+
16
+print(plus5)
17
+
18
+for i in range(0,16):
19
+	plus = "plus{}".format(i)
20
+	print(list(plus))
21
+'''
22
+minus = []
23
+plus =
24
+for i in range(0,16):
25
+	minus[i] = []
26
+	plis[i] = []
27
+
28
+
29
+print(minus, plus)
30
+
31
+'''
32
+plus_15 = []
33
+plus_14 = []
34
+plus_13 = []
35
+plus_12 = []
36
+plus_11 = []
37
+plus_10 = []
38
+plus_9 = []
39
+plus_8 = []
40
+plus_7 = []
41
+plus_6 = []
42
+plus_5 = []
43
+plus_4 = []
44
+plus_3 = []
45
+plus_2 = []
46
+plus_1 = []
47
+plus_0 = []
48
+minus_0 = []
49
+minus_1 = []
50
+minus_2 = []
51
+minus_3 = []
52
+minus_4 = []
53
+minus_5 = []
54
+minus_6 = []
55
+minus_7 = []
56
+minus_8 = []
57
+minus_9 = []
58
+minus_10 = []
59
+minus_11 = []
60
+minus_12 = []
61
+minus_13 = []
62
+minus_14 = []
63
+minus_15 = []
64
+'''
8 65
 
9 66
 '''
10 67
 print(data_set)

+ 2
- 0
train.py View File

@@ -31,6 +31,8 @@ for i in range(params.epoch):
31 31
 		    	#finishing getting the training data
32 32
 		
33 33
 			# start the train on the data
34
+
35
+			# seperate the data into batch size
34 36
 			batch_iteration = int(train_X.shape[0] / params.batch) + 1
35 37
 			for iteration in range(batch_iteration):
36 38
 				batch_X = train_X[iteration*params.batch:(iteration+1)*params.batch]

+ 5
- 3
visualize_raw_data.py View File

@@ -9,21 +9,23 @@ width : 256
9 9
 height : 141
10 10
 '''
11 11
 
12
-file_list = os.listdir('/raw_data')
12
+file_list = os.listdir('/raw_data/bad_data')
13 13
 #print(data_list)
14 14
 
15 15
 for file in file_list:
16 16
 	if file.endswith('.npy'):
17 17
 		print(file)
18
-		file_location = "/raw_data/" + file
18
+		file_location = "/raw_data/bad_data/" + file
19 19
 		loaded_data = np.load(file_location)
20
+		number = 0
20 21
 
21 22
 		for data in loaded_data:
22 23
 			tmp = cv2.flip(data[0],0)
23 24
 			tmp = cv2.flip(tmp,1)
24 25
 			frame = tmp[70:-5,::]
25 26
 			cv2.imshow('frame', frame)
26
-			print(frame.shape, data[1])
27
+			print(frame.shape, data[1], number)
28
+			number += 1
27 29
 		
28 30
 			if cv2.waitKey(1) & 0xFF == ord('q'):
29 31
 				break

Loading…
Cancel
Save