-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmannequin.py
34 lines (30 loc) · 847 Bytes
/
mannequin.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
import numpy as np
from tracking import iou
from pprint import pprint
min_frames = 5
mannq_threshold = 0.85
mann_to_human = 0.70
def remove_mannequin(ids):
"""
ids: dict
ids of ppl with boxes of past frames
"""
for id, val in ids.items():
boxes, flag = val
if len(boxes) == min_frames:
_iou = iou(boxes[0], boxes[-1])
if flag == -1:
if _iou > mannq_threshold:
ids[id][1] = 0
else:
ids[id][1] = 1
if flag == 0 and _iou < mann_to_human:
ids[id][1] = 1
return ids
if __name__ == "__main__":
ids = {
1:[[[9, 10, 12, 12], [12, 11, 12, 14] ], 1],
2:[[[10, 10, 10, 10], [10, 10, 10, 11]], 1]
}
ids = remove_mannequin(ids)
pprint(ids)