-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathload_data.py
More file actions
34 lines (28 loc) · 933 Bytes
/
load_data.py
File metadata and controls
34 lines (28 loc) · 933 Bytes
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
def load_label(filename):
labels = dict()
with open(filename) as f:
for line in f.readlines():
line = line.strip()
if len(line) < 1 or line.startswith("#"):
continue
x_label = line.split(",")[0]
y_label = line.split(",")[-1]
if len(y_label) <1:
print (x_label)
raw_input()
labels[x_label] = y_label
X = []
Y = []
for ele in labels:
X.append(ele)
Y.append(labels[ele])
print ("LOAD total {} labels".format(len(labels)))
print ("LOAD total y {} labels".format(sum(1 for i in labels if labels[i] == 'y')))
print ("LOAD total n {} labels".format(sum(1 for i in labels if labels[i] == 'n')))
return labels
#print load_label("./label_tool/LABEL.label")