Spaces:
Runtime error
Runtime error
Diego Fernández
commited on
Commit
•
de42222
1
Parent(s):
8a03fb5
chore: change distance function thresholds
Browse files- demo_utils/configuration.py +5 -4
- inference.py +6 -1
demo_utils/configuration.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
DISTANCE_THRESHOLD_CENTROID: int = 0.
|
|
|
2 |
MAX_DISTANCE: int = 10000
|
3 |
|
4 |
models_path = {"YOLOv7": "custom_models/yolov7.pt", "YOLOv7 Tiny": "custom_models/yolov7-tiny.pt"}
|
@@ -6,7 +7,7 @@ models_path = {"YOLOv7": "custom_models/yolov7.pt", "YOLOv7 Tiny": "custom_model
|
|
6 |
style = {"Bounding box": "bbox", "Centroid": "centroid"}
|
7 |
|
8 |
examples = {
|
9 |
-
"soccer": {"distance_threshold": 0.
|
10 |
-
"oxford_town_center": {"distance_threshold": 0.
|
11 |
-
"traffic_1_A": {"distance_threshold": 0.
|
12 |
}
|
|
|
1 |
+
DISTANCE_THRESHOLD_CENTROID: int = 0.8
|
2 |
+
DISTANCE_THRESHOLD_BBOX: int = 0.7
|
3 |
MAX_DISTANCE: int = 10000
|
4 |
|
5 |
models_path = {"YOLOv7": "custom_models/yolov7.pt", "YOLOv7 Tiny": "custom_models/yolov7-tiny.pt"}
|
|
|
7 |
style = {"Bounding box": "bbox", "Centroid": "centroid"}
|
8 |
|
9 |
examples = {
|
10 |
+
"soccer": {"distance_threshold": 0.7, "absolute_path": True, "classes": [0]},
|
11 |
+
"oxford_town_center": {"distance_threshold": 0.7, "absolute_path": False, "classes": [0]},
|
12 |
+
"traffic_1_A": {"distance_threshold": 0.7, "absolute_path": False, "classes": [2, 3, 5, 7]},
|
13 |
}
|
inference.py
CHANGED
@@ -5,6 +5,7 @@ from norfair.distances import create_normalized_mean_euclidean_distance
|
|
5 |
|
6 |
from custom_models import YOLO, yolo_detections_to_norfair_detections
|
7 |
from demo_utils.configuration import (
|
|
|
8 |
DISTANCE_THRESHOLD_CENTROID,
|
9 |
examples,
|
10 |
models_path,
|
@@ -44,7 +45,11 @@ def inference(
|
|
44 |
)
|
45 |
|
46 |
distance_function = "iou" if track_points == style["Bounding box"] else "euclidean"
|
47 |
-
distance_threshold =
|
|
|
|
|
|
|
|
|
48 |
|
49 |
if motion_estimation and drawing_paths:
|
50 |
fix_paths = True
|
|
|
5 |
|
6 |
from custom_models import YOLO, yolo_detections_to_norfair_detections
|
7 |
from demo_utils.configuration import (
|
8 |
+
DISTANCE_THRESHOLD_BBOX,
|
9 |
DISTANCE_THRESHOLD_CENTROID,
|
10 |
examples,
|
11 |
models_path,
|
|
|
45 |
)
|
46 |
|
47 |
distance_function = "iou" if track_points == style["Bounding box"] else "euclidean"
|
48 |
+
distance_threshold = (
|
49 |
+
DISTANCE_THRESHOLD_BBOX
|
50 |
+
if track_points == style["Bounding box"]
|
51 |
+
else DISTANCE_THRESHOLD_CENTROID
|
52 |
+
)
|
53 |
|
54 |
if motion_estimation and drawing_paths:
|
55 |
fix_paths = True
|