fitleech commited on
Commit
35f07a7
·
verified ·
1 Parent(s): d9ebd46

Upload folder using huggingface_hub

Browse files
__pycache__/miner.cpython-310.pyc ADDED
Binary file (14.2 kB). View file
 
chute_config.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Image:
2
+ from_base: parachutes/python:3.12
3
+ run_command:
4
+ - pip install --upgrade setuptools wheel
5
+ - pip install 'numpy>=1.23' 'onnxruntime-gpu[cuda,cudnn]>=1.16' 'opencv-python>=4.7' 'pillow>=9.5' 'huggingface_hub>=0.19.4' 'pydantic>=2.0' 'pyyaml>=6.0' 'aiohttp>=3.9'
6
+ - pip install torch torchvision
7
+ - echo "beverage v4 2026-04-30T13:45 tee+pro_6000+torch"
8
+
9
+ NodeSelector:
10
+ gpu_count: 1
11
+ include:
12
+ - pro_6000
13
+
14
+ Chute:
15
+ tee: true
16
+ timeout_seconds: 900
17
+ concurrency: 4
18
+ max_instances: 5
19
+ scaling_threshold: 0.5
20
+ shutdown_after_seconds: 288000
class_names.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ cup
2
+ bottle
3
+ can
miner.py ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """TurboVision beverage detection miner — score-beverage-v3.
2
+
3
+ YOLO11s @ 1280x1280, 3-class beverage detection (bottle/can/cup),
4
+ ONNX with end-to-end NMS baked in (output [1, 300, 6] = x1, y1, x2, y2, conf, cls).
5
+
6
+ Inference pipeline (v3):
7
+ 1) Primary forward pass on the full image.
8
+ 2) Hflip TTA: forward on horizontally-flipped image, transform boxes back.
9
+ 3) Per-class hard-NMS to merge primary + flip outputs.
10
+ 4) Cross-class IoU dedup (suppresses same physical object getting two class labels).
11
+ 5) Consensus-confidence boost: when both views agree on a cluster, take the max
12
+ score so true-positives rank higher in the validator's PR curve.
13
+ 6) Sanity filter (min size, aspect ratio).
14
+ """
15
+
16
+ from pathlib import Path
17
+ import math
18
+
19
+ import cv2
20
+ import numpy as np
21
+ import onnxruntime as ort
22
+ from numpy import ndarray
23
+ from pydantic import BaseModel
24
+
25
+
26
+ class BoundingBox(BaseModel):
27
+ x1: int
28
+ y1: int
29
+ x2: int
30
+ y2: int
31
+ cls_id: int
32
+ conf: float
33
+
34
+
35
+ class TVFrameResult(BaseModel):
36
+ frame_id: int
37
+ boxes: list[BoundingBox]
38
+ keypoints: list[tuple[int, int]]
39
+
40
+
41
+ class Miner:
42
+ def __init__(self, path_hf_repo: Path) -> None:
43
+ model_path = path_hf_repo / "weights.onnx"
44
+
45
+ cn_path = model_path.with_name("class_names.txt")
46
+ if cn_path.is_file():
47
+ self.class_names = [
48
+ ln.strip()
49
+ for ln in cn_path.read_text(encoding="utf-8").splitlines()
50
+ if ln.strip() and not ln.strip().startswith("#")
51
+ ]
52
+ else:
53
+ self.class_names = ["cup", "bottle", "can"]
54
+ self.cls_remap = np.arange(len(self.class_names), dtype=np.int32)
55
+
56
+ print("ORT version:", ort.__version__)
57
+ try:
58
+ ort.preload_dlls()
59
+ print("✅ onnxruntime.preload_dlls() success")
60
+ except Exception as e:
61
+ print(f"⚠️ preload_dlls failed: {e}")
62
+ print("ORT available providers BEFORE session:", ort.get_available_providers())
63
+
64
+ sess_options = ort.SessionOptions()
65
+ sess_options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL
66
+
67
+ try:
68
+ self.session = ort.InferenceSession(
69
+ str(model_path),
70
+ sess_options=sess_options,
71
+ providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
72
+ )
73
+ print("✅ Created ORT session with preferred CUDA provider list")
74
+ except Exception as e:
75
+ print(f"⚠️ CUDA session creation failed, falling back to CPU: {e}")
76
+ self.session = ort.InferenceSession(
77
+ str(model_path),
78
+ sess_options=sess_options,
79
+ providers=["CPUExecutionProvider"],
80
+ )
81
+ print("ORT session providers:", self.session.get_providers())
82
+
83
+ inp = self.session.get_inputs()[0]
84
+ self.input_name = inp.name
85
+ self.output_names = [o.name for o in self.session.get_outputs()]
86
+ self.input_shape = inp.shape
87
+ self.input_dtype = np.float16 if "float16" in inp.type else np.float32
88
+
89
+ self.input_height = self._safe_dim(self.input_shape[2], default=1280)
90
+ self.input_width = self._safe_dim(self.input_shape[3], default=1280)
91
+
92
+ self.conf_thres = 0.20
93
+ self.iou_thres = 0.5
94
+ self.cross_iou_thresh = 0.7
95
+ self.max_det = 300
96
+ self.use_tta = True
97
+
98
+ # Sanity filter — reject obviously bad boxes
99
+ self.min_box_area = 6 * 6
100
+ self.min_side = 4
101
+ self.max_aspect_ratio = 8.0
102
+ self.max_box_area_ratio = 0.95
103
+
104
+ print(f"✅ ONNX loaded: {model_path}")
105
+ print(f"✅ providers: {self.session.get_providers()}")
106
+ print(f"✅ input: name={self.input_name}, shape={self.input_shape}, dtype={self.input_dtype}")
107
+ print(f"✅ classes: {self.class_names}")
108
+ print(f"✅ config: conf={self.conf_thres}, iou={self.iou_thres}, "
109
+ f"cross_iou={self.cross_iou_thresh}, TTA={self.use_tta}")
110
+
111
+ def __repr__(self) -> str:
112
+ return (
113
+ f"ONNXRuntime(session={type(self.session).__name__}, "
114
+ f"providers={self.session.get_providers()})"
115
+ )
116
+
117
+ @staticmethod
118
+ def _safe_dim(value, default: int) -> int:
119
+ return value if isinstance(value, int) and value > 0 else default
120
+
121
+ def _letterbox(
122
+ self,
123
+ image: ndarray,
124
+ new_shape: tuple[int, int],
125
+ color=(114, 114, 114),
126
+ ) -> tuple[ndarray, float, tuple[float, float]]:
127
+ h, w = image.shape[:2]
128
+ new_w, new_h = new_shape
129
+ ratio = min(new_w / w, new_h / h)
130
+ resized_w = int(round(w * ratio))
131
+ resized_h = int(round(h * ratio))
132
+ if (resized_w, resized_h) != (w, h):
133
+ interp = cv2.INTER_CUBIC if ratio > 1.0 else cv2.INTER_LINEAR
134
+ image = cv2.resize(image, (resized_w, resized_h), interpolation=interp)
135
+ dw = (new_w - resized_w) / 2.0
136
+ dh = (new_h - resized_h) / 2.0
137
+ left = int(round(dw - 0.1))
138
+ right = int(round(dw + 0.1))
139
+ top = int(round(dh - 0.1))
140
+ bottom = int(round(dh + 0.1))
141
+ padded = cv2.copyMakeBorder(
142
+ image, top, bottom, left, right,
143
+ borderType=cv2.BORDER_CONSTANT, value=color,
144
+ )
145
+ return padded, ratio, (dw, dh)
146
+
147
+ def _preprocess(self, image: ndarray):
148
+ orig_h, orig_w = image.shape[:2]
149
+ img, ratio, pad = self._letterbox(image, (self.input_width, self.input_height))
150
+ img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
151
+ img = img.astype(self.input_dtype) / 255.0
152
+ img = np.transpose(img, (2, 0, 1))[None, ...]
153
+ img = np.ascontiguousarray(img)
154
+ return img, ratio, pad, (orig_w, orig_h)
155
+
156
+ @staticmethod
157
+ def _clip_boxes(boxes: np.ndarray, image_size: tuple[int, int]) -> np.ndarray:
158
+ w, h = image_size
159
+ boxes[:, 0] = np.clip(boxes[:, 0], 0, w - 1)
160
+ boxes[:, 1] = np.clip(boxes[:, 1], 0, h - 1)
161
+ boxes[:, 2] = np.clip(boxes[:, 2], 0, w - 1)
162
+ boxes[:, 3] = np.clip(boxes[:, 3], 0, h - 1)
163
+ return boxes
164
+
165
+ def _filter_sane_boxes(
166
+ self,
167
+ boxes: np.ndarray,
168
+ scores: np.ndarray,
169
+ cls_ids: np.ndarray,
170
+ orig_size: tuple[int, int],
171
+ ):
172
+ if len(boxes) == 0:
173
+ return boxes, scores, cls_ids
174
+ orig_w, orig_h = orig_size
175
+ image_area = float(orig_w * orig_h)
176
+ keep = []
177
+ for i, box in enumerate(boxes):
178
+ x1, y1, x2, y2 = box.tolist()
179
+ bw = x2 - x1
180
+ bh = y2 - y1
181
+ if bw <= 0 or bh <= 0:
182
+ continue
183
+ if bw < self.min_side or bh < self.min_side:
184
+ continue
185
+ area = bw * bh
186
+ if area < self.min_box_area:
187
+ continue
188
+ if area > self.max_box_area_ratio * image_area:
189
+ continue
190
+ ar = max(bw / max(bh, 1e-6), bh / max(bw, 1e-6))
191
+ if ar > self.max_aspect_ratio:
192
+ continue
193
+ keep.append(i)
194
+ if not keep:
195
+ return (
196
+ np.empty((0, 4), dtype=np.float32),
197
+ np.empty((0,), dtype=np.float32),
198
+ np.empty((0,), dtype=np.int32),
199
+ )
200
+ k = np.array(keep, dtype=np.intp)
201
+ return boxes[k], scores[k], cls_ids[k]
202
+
203
+ @staticmethod
204
+ def _hard_nms(
205
+ boxes: np.ndarray,
206
+ scores: np.ndarray,
207
+ iou_thresh: float,
208
+ ) -> np.ndarray:
209
+ N = len(boxes)
210
+ if N == 0:
211
+ return np.array([], dtype=np.intp)
212
+ boxes = np.asarray(boxes, dtype=np.float32)
213
+ scores = np.asarray(scores, dtype=np.float32)
214
+ order = np.argsort(scores)[::-1]
215
+ keep: list[int] = []
216
+ suppressed = np.zeros(N, dtype=bool)
217
+ for i in range(N):
218
+ idx = order[i]
219
+ if suppressed[idx]:
220
+ continue
221
+ keep.append(int(idx))
222
+ bi = boxes[idx]
223
+ for k in range(i + 1, N):
224
+ jdx = order[k]
225
+ if suppressed[jdx]:
226
+ continue
227
+ bj = boxes[jdx]
228
+ xx1 = max(bi[0], bj[0])
229
+ yy1 = max(bi[1], bj[1])
230
+ xx2 = min(bi[2], bj[2])
231
+ yy2 = min(bi[3], bj[3])
232
+ inter = max(0.0, xx2 - xx1) * max(0.0, yy2 - yy1)
233
+ area_i = (bi[2] - bi[0]) * (bi[3] - bi[1])
234
+ area_j = (bj[2] - bj[0]) * (bj[3] - bj[1])
235
+ iou = inter / (area_i + area_j - inter + 1e-7)
236
+ if iou > iou_thresh:
237
+ suppressed[jdx] = True
238
+ return np.array(keep, dtype=np.intp)
239
+
240
+ def _per_class_hard_nms(
241
+ self,
242
+ boxes: np.ndarray,
243
+ scores: np.ndarray,
244
+ cls_ids: np.ndarray,
245
+ iou_thresh: float,
246
+ ) -> np.ndarray:
247
+ if len(boxes) == 0:
248
+ return np.array([], dtype=np.intp)
249
+ all_keep: list[int] = []
250
+ for c in np.unique(cls_ids):
251
+ mask = cls_ids == c
252
+ indices = np.where(mask)[0]
253
+ keep = self._hard_nms(boxes[mask], scores[mask], iou_thresh)
254
+ all_keep.extend(indices[keep].tolist())
255
+ all_keep.sort()
256
+ return np.array(all_keep, dtype=np.intp)
257
+
258
+ @staticmethod
259
+ def _cross_class_dedup(
260
+ boxes: np.ndarray,
261
+ scores: np.ndarray,
262
+ cls_ids: np.ndarray,
263
+ iou_thresh: float,
264
+ ) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
265
+ n = len(boxes)
266
+ if n <= 1:
267
+ return boxes, scores, cls_ids
268
+ boxes = np.asarray(boxes, dtype=np.float32)
269
+ scores = np.asarray(scores, dtype=np.float32)
270
+ cls_ids = np.asarray(cls_ids, dtype=np.int32)
271
+ areas = np.maximum(0.0, boxes[:, 2] - boxes[:, 0]) * np.maximum(
272
+ 0.0, boxes[:, 3] - boxes[:, 1]
273
+ )
274
+ # Keep larger boxes first, then higher score.
275
+ order = np.lexsort((-scores, -areas))
276
+ suppressed = np.zeros(n, dtype=bool)
277
+ keep: list[int] = []
278
+ for i in order:
279
+ if suppressed[i]:
280
+ continue
281
+ keep.append(int(i))
282
+ bi = boxes[i]
283
+ xx1 = np.maximum(bi[0], boxes[:, 0])
284
+ yy1 = np.maximum(bi[1], boxes[:, 1])
285
+ xx2 = np.minimum(bi[2], boxes[:, 2])
286
+ yy2 = np.minimum(bi[3], boxes[:, 3])
287
+ inter = np.maximum(0.0, xx2 - xx1) * np.maximum(0.0, yy2 - yy1)
288
+ area_i = max(1e-7, float((bi[2] - bi[0]) * (bi[3] - bi[1])))
289
+ union = area_i + areas - inter + 1e-7
290
+ iou = inter / union
291
+ dup = iou > iou_thresh
292
+ dup[i] = False
293
+ suppressed |= dup
294
+ keep_idx = np.array(keep, dtype=np.intp)
295
+ return boxes[keep_idx], scores[keep_idx], cls_ids[keep_idx]
296
+
297
+ @staticmethod
298
+ def _max_score_per_cluster(
299
+ coords: np.ndarray,
300
+ scores: np.ndarray,
301
+ keep_indices: np.ndarray,
302
+ iou_thresh: float,
303
+ ) -> np.ndarray:
304
+ n_keep = len(keep_indices)
305
+ if n_keep == 0:
306
+ return np.array([], dtype=np.float32)
307
+ coords = np.asarray(coords, dtype=np.float32)
308
+ scores = np.asarray(scores, dtype=np.float32)
309
+ out = np.empty(n_keep, dtype=np.float32)
310
+ for i in range(n_keep):
311
+ idx = keep_indices[i]
312
+ bi = coords[idx]
313
+ xx1 = np.maximum(bi[0], coords[:, 0])
314
+ yy1 = np.maximum(bi[1], coords[:, 1])
315
+ xx2 = np.minimum(bi[2], coords[:, 2])
316
+ yy2 = np.minimum(bi[3], coords[:, 3])
317
+ inter = np.maximum(0.0, xx2 - xx1) * np.maximum(0.0, yy2 - yy1)
318
+ area_i = (bi[2] - bi[0]) * (bi[3] - bi[1])
319
+ areas_j = (coords[:, 2] - coords[:, 0]) * (coords[:, 3] - coords[:, 1])
320
+ iou = inter / (area_i + areas_j - inter + 1e-7)
321
+ in_cluster = iou >= iou_thresh
322
+ out[i] = float(np.max(scores[in_cluster]))
323
+ return out
324
+
325
+ def _decode_raw_dets(
326
+ self,
327
+ preds: np.ndarray,
328
+ ratio: float,
329
+ pad: tuple[float, float],
330
+ orig_size: tuple[int, int],
331
+ ) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
332
+ """Decode end2end NMS output and return (boxes, scores, cls_ids)
333
+ in original image coordinates, after conf-threshold + remap + letterbox-reverse + sanity."""
334
+ if preds.ndim == 3 and preds.shape[0] == 1:
335
+ preds = preds[0]
336
+ if preds.ndim != 2 or preds.shape[1] < 6:
337
+ raise ValueError(f"Unexpected ONNX output shape: {preds.shape}")
338
+
339
+ boxes = preds[:, :4].astype(np.float32)
340
+ scores = preds[:, 4].astype(np.float32)
341
+ cls_ids = preds[:, 5].astype(np.int32)
342
+
343
+ valid = (cls_ids >= 0) & (cls_ids < len(self.cls_remap))
344
+ boxes, scores, cls_ids = boxes[valid], scores[valid], cls_ids[valid]
345
+ cls_ids = self.cls_remap[cls_ids]
346
+
347
+ keep = scores >= self.conf_thres
348
+ boxes = boxes[keep]
349
+ scores = scores[keep]
350
+ cls_ids = cls_ids[keep]
351
+ if len(boxes) == 0:
352
+ return (
353
+ np.empty((0, 4), dtype=np.float32),
354
+ np.empty((0,), dtype=np.float32),
355
+ np.empty((0,), dtype=np.int32),
356
+ )
357
+
358
+ pad_w, pad_h = pad
359
+ orig_w, orig_h = orig_size
360
+ boxes[:, [0, 2]] -= pad_w
361
+ boxes[:, [1, 3]] -= pad_h
362
+ boxes /= ratio
363
+ boxes = self._clip_boxes(boxes, (orig_w, orig_h))
364
+
365
+ boxes, scores, cls_ids = self._filter_sane_boxes(boxes, scores, cls_ids, orig_size)
366
+ return boxes, scores, cls_ids
367
+
368
+ def _forward(
369
+ self, image: np.ndarray
370
+ ) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
371
+ x, ratio, pad, orig_size = self._preprocess(image)
372
+ out = self.session.run(self.output_names, {self.input_name: x})[0]
373
+ return self._decode_raw_dets(out, ratio, pad, orig_size)
374
+
375
+ def _predict_single(self, image: np.ndarray) -> list[BoundingBox]:
376
+ boxes, scores, cls_ids = self._forward(image)
377
+ if len(boxes) == 0:
378
+ return []
379
+ return self._build_results(boxes, scores, cls_ids)
380
+
381
+ def _predict_tta(self, image: np.ndarray) -> list[BoundingBox]:
382
+ """Hflip TTA: merge primary + flipped via per-class hard-NMS,
383
+ then cross-class dedup, with consensus-confidence boost."""
384
+ ow = image.shape[1]
385
+ b1, s1, c1 = self._forward(image)
386
+
387
+ flipped = cv2.flip(image, 1)
388
+ b2, s2, c2 = self._forward(flipped)
389
+ if len(b2):
390
+ x1f = ow - b2[:, 2]
391
+ x2f = ow - b2[:, 0]
392
+ b2 = np.stack([x1f, b2[:, 1], x2f, b2[:, 3]], axis=1)
393
+
394
+ if len(b1) == 0 and len(b2) == 0:
395
+ return []
396
+
397
+ boxes = np.concatenate([b1, b2], axis=0) if len(b2) else b1
398
+ scores = np.concatenate([s1, s2], axis=0) if len(b2) else s1
399
+ cls_ids = np.concatenate([c1, c2], axis=0) if len(b2) else c1
400
+
401
+ keep = self._per_class_hard_nms(boxes, scores, cls_ids, self.iou_thres)
402
+ if len(keep) == 0:
403
+ return []
404
+ keep = keep[: self.max_det]
405
+
406
+ # Consensus-confidence boost: cluster by IoU and take max score.
407
+ boosted = self._max_score_per_cluster(boxes, scores, keep, self.iou_thres)
408
+
409
+ boxes = boxes[keep]
410
+ cls_ids = cls_ids[keep]
411
+ scores = boosted
412
+
413
+ boxes, scores, cls_ids = self._cross_class_dedup(
414
+ boxes, scores, cls_ids, self.cross_iou_thresh
415
+ )
416
+ if len(boxes) == 0:
417
+ return []
418
+
419
+ return self._build_results(boxes, scores, cls_ids)
420
+
421
+ def _build_results(
422
+ self, boxes: np.ndarray, scores: np.ndarray, cls_ids: np.ndarray
423
+ ) -> list[BoundingBox]:
424
+ results: list[BoundingBox] = []
425
+ for box, conf, cls_id in zip(boxes, scores, cls_ids):
426
+ x1, y1, x2, y2 = box.tolist()
427
+ if x2 <= x1 or y2 <= y1:
428
+ continue
429
+ results.append(
430
+ BoundingBox(
431
+ x1=int(math.floor(x1)),
432
+ y1=int(math.floor(y1)),
433
+ x2=int(math.ceil(x2)),
434
+ y2=int(math.ceil(y2)),
435
+ cls_id=int(cls_id),
436
+ conf=float(conf),
437
+ )
438
+ )
439
+ return results
440
+
441
+ def predict_batch(
442
+ self,
443
+ batch_images: list[ndarray],
444
+ offset: int,
445
+ n_keypoints: int,
446
+ ) -> list[TVFrameResult]:
447
+ results: list[TVFrameResult] = []
448
+ for frame_number_in_batch, image in enumerate(batch_images):
449
+ if image is None or not isinstance(image, np.ndarray) or image.ndim != 3:
450
+ results.append(
451
+ TVFrameResult(
452
+ frame_id=offset + frame_number_in_batch,
453
+ boxes=[],
454
+ keypoints=[(0, 0) for _ in range(max(0, int(n_keypoints)))],
455
+ )
456
+ )
457
+ continue
458
+ if image.dtype != np.uint8:
459
+ image = image.astype(np.uint8)
460
+ try:
461
+ if self.use_tta:
462
+ boxes = self._predict_tta(image)
463
+ else:
464
+ boxes = self._predict_single(image)
465
+ except Exception as e:
466
+ print(f"⚠️ Inference failed for frame {offset + frame_number_in_batch}: {e}")
467
+ boxes = []
468
+ results.append(
469
+ TVFrameResult(
470
+ frame_id=offset + frame_number_in_batch,
471
+ boxes=boxes,
472
+ keypoints=[(0, 0) for _ in range(max(0, int(n_keypoints)))],
473
+ )
474
+ )
475
+ return results
weights.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19ae76c63971dadbb0633df2bd60fbe4539a256d3a55471666b5362a664c5bbe
3
+ size 19300186