-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathData_load_spec.py
More file actions
58 lines (42 loc) · 1.56 KB
/
Data_load_spec.py
File metadata and controls
58 lines (42 loc) · 1.56 KB
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
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/" + weather + "/" + exist + "/" + str(sensor_use) + "/")
print(os.getcwd())
for filename in os.listdir("."):
namelist = filename.split('_')
name = namelist[3].split('-')
if name[0] == "03" or (name[0] == "04" and namelist[5].startswith("None")):
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]