-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (25 loc) · 853 Bytes
/
app.py
File metadata and controls
31 lines (25 loc) · 853 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
import os
import utils
import json
def main(args):
detections = []
for results in utils.runner.run(args):
if not len(detections):
for _ in range(len(results)):
detections.append([])
for idx, result in enumerate(results):
for obj in result:
detections[idx].append(obj)
for i, det in enumerate(detections):
path, name = os.path.split(args.dets_path)
if args.return_intermediate:
save_name = f"stage#{i}_{name}"
else:
save_name = name
with open(os.path.join(path, save_name), "w") as outfile:
json.dump(det, outfile)
print ("Data written to: ", os.path.join(path, save_name))
if __name__ == '__main__':
args = utils.argparser.parse_args()
main(args)
print ("Main finished")