-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformulation.py
More file actions
43 lines (32 loc) · 1.1 KB
/
formulation.py
File metadata and controls
43 lines (32 loc) · 1.1 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
import os
import sys
widerval_pred = './prediction/'
widerval_formulation = './formulation/'
fin = open('wider_face_train_image.txt','r')
while True:
im_path = fin.readline().replace('\r','').replace('\n','').replace('\t','')
if not im_path:
break
im_path = os.path.splitext(im_path)[0]
full_im_predict_path = os.path.join(widerval_pred, im_path + '.txt')
full_im_formulation_path = os.path.join(widerval_formulation, im_path + '.txt')
# mkdir
if not os.path.exists(os.path.join(widerval_formulation, os.path.dirname(im_path))):
os.makedirs(os.path.join(widerval_formulation, os.path.dirname(im_path)))
# open prediction txt
fdet = open(full_im_predict_path,'r')
fout = open(full_im_formulation_path,'a')
fout.write(im_path+'.jpg')
fout.write('\n')
fdet.readline()
temp = fdet.readline().replace('\r','').replace('\n','').replace('\t','')
num = int(temp)
if num >= 0:
fout.write("%d\n" % num)
while num > 0:
fout.write(fdet.readline())
num = num - 1
fdet.close()
fout.close()
pass
fin.close()