Spaces:
Running
Running
fix batch processing error
Browse files- backend/engine.py +11 -1
backend/engine.py
CHANGED
|
@@ -123,7 +123,17 @@ def run(model, video_path, line, config, on_frame, save_annotated=False, annotat
|
|
| 123 |
a = line[0]
|
| 124 |
b = line[1]
|
| 125 |
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
active = 0
|
| 128 |
cur_boxes = None
|
| 129 |
cur_ids = None
|
|
|
|
| 123 |
a = line[0]
|
| 124 |
b = line[1]
|
| 125 |
|
| 126 |
+
iterator = iter(enumerate(results))
|
| 127 |
+
while True:
|
| 128 |
+
try:
|
| 129 |
+
frame_idx, r = next(iterator)
|
| 130 |
+
except StopIteration:
|
| 131 |
+
break
|
| 132 |
+
except RuntimeError as e:
|
| 133 |
+
if "incompatible" in str(e) and "shape=" in str(e):
|
| 134 |
+
print(f"[BACKEND] Ignored OpenVINO shape mismatch on final trailing batch.")
|
| 135 |
+
break
|
| 136 |
+
raise e
|
| 137 |
active = 0
|
| 138 |
cur_boxes = None
|
| 139 |
cur_ids = None
|