-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_json.py
57 lines (39 loc) · 1.14 KB
/
read_json.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
import json
with open('/home/scopeserver/RaidDisk/DeepLearning/mwang/data/scope_style_with_bbox.json') as f:
data = json.load(f)
count=1
rows =[]
for item in data:
if item['image_detected_result'] =='':
continue
else:
#print item
#print item['image_detected_result']
filename = item['image_retina']
gender=item['product_gender']
if gender==1:
continue
singleproduct=item['image_primary']
if singleproduct==1:
continue
d=json.loads(item['image_detected_result'])
if d.has_key('data')==False:
continue
bbox=d['data']
if len(bbox)<1:
continue
for box in bbox:
x=box['x']
y=box['y']
w=box['w']
h=box['h']
name=box['name']
if name == 'tops' or name == 'outerwear':
if w > h:
continue
rows.append([filename,gender,x,y,w,h,name])
count=count+1
print count
csvfile=open('record_men.csv','w')
for row in rows:
print>>csvfile, row