Subh775 commited on
Commit
ff9d3a8
·
1 Parent(s): 64b79c3
Files changed (2) hide show
  1. backend/engine.py +3 -2
  2. backend/server.py +2 -2
backend/engine.py CHANGED
@@ -110,13 +110,14 @@ def run(model, video_path, line, config, on_frame, save_annotated=False, annotat
110
  results = model.track(
111
  source=video_path,
112
  tracker="bytetrack.yaml",
113
- imgsz=config["imgsz"],
114
  conf=config.get("conf", 0.12),
115
  iou=config.get("iou", 0.6),
116
  vid_stride=stride,
117
  stream=True,
118
  verbose=False,
119
- persist=False # MUST be False — True causes ByteTracker state leak across runs
 
120
  )
121
 
122
  a = line[0]
 
110
  results = model.track(
111
  source=video_path,
112
  tracker="bytetrack.yaml",
113
+ imgsz=736, # MUST match OpenVINO export imgsz
114
  conf=config.get("conf", 0.12),
115
  iou=config.get("iou", 0.6),
116
  vid_stride=stride,
117
  stream=True,
118
  verbose=False,
119
+ persist=False, # MUST be False — True causes ByteTracker state leak across runs
120
+ batch=2 # MUST match OpenVINO export batch size
121
  )
122
 
123
  a = line[0]
backend/server.py CHANGED
@@ -39,8 +39,8 @@ async def lifespan(app: FastAPI):
39
  # Warm up: run a dummy inference so OpenVINO compiles its graph now,
40
  # not on the first real user request
41
  try:
42
- dummy = np.zeros((640, 640, 3), dtype=np.uint8) # HWC — what YOLO predict() expects
43
- model(dummy, verbose=False)
44
  print("[BACKEND] Model warm-up complete.")
45
  except Exception as e:
46
  print(f"[BACKEND] Warm-up skipped: {e}")
 
39
  # Warm up: run a dummy inference so OpenVINO compiles its graph now,
40
  # not on the first real user request
41
  try:
42
+ dummy_img = np.zeros((736, 736, 3), dtype=np.uint8)
43
+ model([dummy_img, dummy_img], verbose=False) # list of 2 imgs triggers batch=2
44
  print("[BACKEND] Model warm-up complete.")
45
  except Exception as e:
46
  print(f"[BACKEND] Warm-up skipped: {e}")