-
Notifications
You must be signed in to change notification settings - Fork 2
/
Data_load_sub.py
53 lines (39 loc) · 1.37 KB
/
Data_load_sub.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
import numpy as np
import os
def Data_load(weather, exist, sensor_use, X, Y):
current_path = os.getcwd()
classfication = Labeling_tag(weather, exist)
print(classfication)
os.chdir("labeled_data_sub/" + weather + "/" + exist + "/" + str(sensor_use) + "/")
print(os.getcwd())
for filename in os.listdir("."):
print(filename)
data = np.loadtxt(filename, delimiter=",", dtype=np.float32)
for i in range(0, data.__len__()):
X.append(data[i])
Y.append(classfication)
if classfication[2] == 1 and i > 200 :
print("Cut.. ! (>200)")
break
os.chdir(current_path)
def Data_find_load(weather, exist, sensor_use, X, Y):
current_path = os.getcwd()
def Labeling_tag(weather, exist):
if weather == "Sunny":
if exist == "Animal":
return [1, 0, 0, 1, 0, 0]
elif exist == "Both":
return [1, 0, 0, 0, 1, 0]
elif exist == "Human":
return [1, 0, 0, 0, 0, 1]
elif exist == "None":
return [1, 0, 1, 0, 0, 0]
elif weather == "Rain":
if exist == "Animal":
return [0, 1, 0, 1, 0, 0]
elif exist == "Both":
return [0, 1, 0, 0, 1, 0]
elif exist == "Human":
return [0, 1, 0, 0, 0, 1]
elif exist == "None":
return [0, 1, 1, 0, 0, 0]