Spaces:
Runtime error
Runtime error
diegofernandezc
commited on
Commit
•
8a03fb5
1
Parent(s):
1cc025d
Update distance functions
Browse files- inference.py +6 -9
inference.py
CHANGED
@@ -43,9 +43,7 @@ def inference(
|
|
43 |
max_points=500, min_distance=7, transformations_getter=transformations_getter
|
44 |
)
|
45 |
|
46 |
-
distance_function =
|
47 |
-
video.input_height, video.input_width
|
48 |
-
)
|
49 |
distance_threshold = DISTANCE_THRESHOLD_CENTROID
|
50 |
|
51 |
if motion_estimation and drawing_paths:
|
@@ -90,13 +88,12 @@ def inference(
|
|
90 |
detections=detections, coord_transformations=coord_transformations
|
91 |
)
|
92 |
|
93 |
-
mask = np.ones(frame.shape[:2], frame.dtype)
|
94 |
-
if track_points == "bbox":
|
95 |
-
for det in detections:
|
96 |
-
i = det.points.astype(int)
|
97 |
-
mask[i[0, 1] : i[1, 1], i[0, 0] : i[1, 0]] = 0
|
98 |
-
|
99 |
if motion_estimation:
|
|
|
|
|
|
|
|
|
|
|
100 |
coord_transformations = motion_estimator.update(frame, mask)
|
101 |
|
102 |
frame = draw(
|
|
|
43 |
max_points=500, min_distance=7, transformations_getter=transformations_getter
|
44 |
)
|
45 |
|
46 |
+
distance_function = "iou" if track_points == style["Bounding box"] else "euclidean"
|
|
|
|
|
47 |
distance_threshold = DISTANCE_THRESHOLD_CENTROID
|
48 |
|
49 |
if motion_estimation and drawing_paths:
|
|
|
88 |
detections=detections, coord_transformations=coord_transformations
|
89 |
)
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
if motion_estimation:
|
92 |
+
mask = np.ones(frame.shape[:2], frame.dtype)
|
93 |
+
if track_points == "bbox":
|
94 |
+
for det in detections:
|
95 |
+
i = det.points.astype(int)
|
96 |
+
mask[i[0, 1] : i[1, 1], i[0, 0] : i[1, 0]] = 0
|
97 |
coord_transformations = motion_estimator.update(frame, mask)
|
98 |
|
99 |
frame = draw(
|