scorevision: push artifact
Browse files
miner.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
"""
|
| 2 |
-
Score Vision SN44 — Unified miner v3.23.
|
| 3 |
Tri-model: vehicle (YOLO11m INT8 1280) + person (YOLO12s FP16 960 TRT) + petrol (end2end 640).
|
| 4 |
Pose model: YOLOv8n-pose FP16 640 for false-positive filtering + keypoint box refinement.
|
| 5 |
Vehicle weights loaded from secondary HF repo (meaculpitt/ScoreVision-Vehicle).
|
|
@@ -602,20 +602,18 @@ class Miner:
|
|
| 602 |
self.veh_h = int(veh_shape[2])
|
| 603 |
self.veh_w = int(veh_shape[3])
|
| 604 |
|
| 605 |
-
# FP32 fallback
|
| 606 |
self.veh_session_fp32 = None
|
|
|
|
| 607 |
try:
|
| 608 |
veh_fp32 = str(veh_path / "vehicle_weights_fp32.onnx") if veh_path else None
|
| 609 |
if veh_fp32 and Path(veh_fp32).exists():
|
| 610 |
-
self.
|
| 611 |
-
|
| 612 |
-
providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
|
| 613 |
-
)
|
| 614 |
-
logger.info("[init] Vehicle FP32 fallback model loaded")
|
| 615 |
else:
|
| 616 |
logger.info("[init] Vehicle FP32 fallback not available")
|
| 617 |
except Exception as e:
|
| 618 |
-
logger.warning(f"[init] Vehicle FP32 fallback failed: {e}")
|
| 619 |
|
| 620 |
# Person model — CUDA immediately, TRT engine builds in background
|
| 621 |
per_onnx = str(path_hf_repo / "person_weights.onnx")
|
|
@@ -938,14 +936,26 @@ class Miner:
|
|
| 938 |
"""
|
| 939 |
boxes = self._infer_vehicle_core(image_bgr, self.veh_session)
|
| 940 |
|
| 941 |
-
if len(boxes) == 0 and self.veh_session_fp32:
|
| 942 |
-
|
| 943 |
-
if
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 949 |
|
| 950 |
return boxes
|
| 951 |
|
|
|
|
| 1 |
"""
|
| 2 |
+
Score Vision SN44 — Unified miner v3.23.2 (2026-04-07). Force 24GB GPU, lazy-load FP32 fallback. FP32 trigger 0 boxes only. TTA consensus (person), parts_confirm on vehicle challenges, car conf 0.60, VEH_MIN_WH=20.
|
| 3 |
Tri-model: vehicle (YOLO11m INT8 1280) + person (YOLO12s FP16 960 TRT) + petrol (end2end 640).
|
| 4 |
Pose model: YOLOv8n-pose FP16 640 for false-positive filtering + keypoint box refinement.
|
| 5 |
Vehicle weights loaded from secondary HF repo (meaculpitt/ScoreVision-Vehicle).
|
|
|
|
| 602 |
self.veh_h = int(veh_shape[2])
|
| 603 |
self.veh_w = int(veh_shape[3])
|
| 604 |
|
| 605 |
+
# FP32 fallback — lazy-loaded on first trigger to save ~300MB VRAM at startup
|
| 606 |
self.veh_session_fp32 = None
|
| 607 |
+
self._veh_fp32_path = None
|
| 608 |
try:
|
| 609 |
veh_fp32 = str(veh_path / "vehicle_weights_fp32.onnx") if veh_path else None
|
| 610 |
if veh_fp32 and Path(veh_fp32).exists():
|
| 611 |
+
self._veh_fp32_path = veh_fp32
|
| 612 |
+
logger.info("[init] Vehicle FP32 fallback available (lazy-load)")
|
|
|
|
|
|
|
|
|
|
| 613 |
else:
|
| 614 |
logger.info("[init] Vehicle FP32 fallback not available")
|
| 615 |
except Exception as e:
|
| 616 |
+
logger.warning(f"[init] Vehicle FP32 fallback path check failed: {e}")
|
| 617 |
|
| 618 |
# Person model — CUDA immediately, TRT engine builds in background
|
| 619 |
per_onnx = str(path_hf_repo / "person_weights.onnx")
|
|
|
|
| 936 |
"""
|
| 937 |
boxes = self._infer_vehicle_core(image_bgr, self.veh_session)
|
| 938 |
|
| 939 |
+
if len(boxes) == 0 and (self.veh_session_fp32 or self._veh_fp32_path):
|
| 940 |
+
# Lazy-load FP32 session on first trigger
|
| 941 |
+
if self.veh_session_fp32 is None and self._veh_fp32_path:
|
| 942 |
+
try:
|
| 943 |
+
self.veh_session_fp32 = ort.InferenceSession(
|
| 944 |
+
self._veh_fp32_path,
|
| 945 |
+
providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
|
| 946 |
+
)
|
| 947 |
+
logger.info("[vehicle] FP32 fallback lazy-loaded")
|
| 948 |
+
except Exception as e:
|
| 949 |
+
logger.warning(f"[vehicle] FP32 lazy-load failed: {e}")
|
| 950 |
+
self._veh_fp32_path = None
|
| 951 |
+
if self.veh_session_fp32:
|
| 952 |
+
boxes_fp32 = self._infer_vehicle_core(image_bgr, self.veh_session_fp32)
|
| 953 |
+
if len(boxes_fp32) > len(boxes):
|
| 954 |
+
logger.warning(
|
| 955 |
+
f"[vehicle] INT8 degraded ({len(boxes)} boxes), "
|
| 956 |
+
f"FP32 fallback recovered ({len(boxes_fp32)} boxes)"
|
| 957 |
+
)
|
| 958 |
+
return boxes_fp32
|
| 959 |
|
| 960 |
return boxes
|
| 961 |
|