Spaces:
Running
Running
retained threadedvideowriter
Browse files- backend/engine.py +3 -4
backend/engine.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import os
|
| 2 |
import time
|
| 3 |
import tempfile
|
|
|
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
import cv2
|
| 6 |
from collections import defaultdict
|
|
@@ -20,9 +22,6 @@ def _point_to_segment_dist(px, py, ax, ay, bx, by):
|
|
| 20 |
return np.linalg.norm(P - (A + t * AB))
|
| 21 |
|
| 22 |
|
| 23 |
-
import threading
|
| 24 |
-
import queue
|
| 25 |
-
|
| 26 |
# Lightweight drawing colors (BGR for OpenCV)
|
| 27 |
_CLR_BOX = (230, 180, 50) # teal-ish
|
| 28 |
_CLR_LINE = (80, 220, 100) # green
|
|
@@ -150,7 +149,7 @@ def run(model, video_path, line, config, on_frame, save_annotated=False, annotat
|
|
| 150 |
results = model.track(
|
| 151 |
source=video_path,
|
| 152 |
tracker="bytetrack.yaml",
|
| 153 |
-
imgsz=
|
| 154 |
conf=config.get("conf", 0.12),
|
| 155 |
iou=config.get("iou", 0.6),
|
| 156 |
vid_stride=stride,
|
|
|
|
| 1 |
import os
|
| 2 |
import time
|
| 3 |
import tempfile
|
| 4 |
+
import threading
|
| 5 |
+
import queue
|
| 6 |
import numpy as np
|
| 7 |
import cv2
|
| 8 |
from collections import defaultdict
|
|
|
|
| 22 |
return np.linalg.norm(P - (A + t * AB))
|
| 23 |
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
# Lightweight drawing colors (BGR for OpenCV)
|
| 26 |
_CLR_BOX = (230, 180, 50) # teal-ish
|
| 27 |
_CLR_LINE = (80, 220, 100) # green
|
|
|
|
| 149 |
results = model.track(
|
| 150 |
source=video_path,
|
| 151 |
tracker="bytetrack.yaml",
|
| 152 |
+
imgsz=736, # MUST match OpenVINO export imgsz — compiled graph is fixed shape
|
| 153 |
conf=config.get("conf", 0.12),
|
| 154 |
iou=config.get("iou", 0.6),
|
| 155 |
vid_stride=stride,
|