baxtos commited on
Commit
0859aca
·
verified ·
1 Parent(s): a076d54

scorevision: push artifact

Browse files
Files changed (1) hide show
  1. miner.py +19 -16
miner.py CHANGED
@@ -1,18 +1,21 @@
1
- # build-rev: 2026-05-28-02 (forces new HF SHA → new chute nickname; prior swan build failed on Chutes registry push)
2
- """Open-source Detect-beverage miner v12 (new yolo11s weights + NMS-baked ONNX).
3
 
4
- New v12 ONNX weights: trained on combined dataset (375 fresh cross-consensus
5
- pseudo-GT from top 3 Beverage miners + 279 prior validator-pseudo). NMS-baked
6
- export output shape `[1, 300, 6]` (xyxy, conf, cls). On holdout 73 imgs:
7
- ultralytics-val mAP50=0.879 (v8: 0.835).
 
 
 
8
 
9
  Post-proc:
10
  - detect NMS-baked output and unpack to (N, 4+num_classes) one-hot scores
11
- - per-class conf filter `[0.60, 0.40, 0.60]` (best from sweep on v12 ONNX)
12
  - sane-box geometric filter (min_box_area=100, max_aspect_ratio=10)
13
  - per-class hard NMS @ iou=0.4 (redundant after baked NMS but safe)
14
- - cross-class dedup @ iou=0.7
15
- - TTA off (sweep showed flip-TTA + cluster-boost hurt UI on NMS-baked output)
16
 
17
  Contract: class `Miner` at HF root, `predict_batch(...) -> list[TVFrameResult]`.
18
  """
@@ -48,9 +51,9 @@ class Miner:
48
  input_size = 1280
49
  num_classes = 3 # cup, bottle, can
50
 
51
- # per-class conf — best v12 sweep without TTA (UI 80.32%, FP 0.832):
52
- conf_thres = np.array([0.60, 0.40, 0.60], dtype=np.float32)
53
- # rescue bonus disabled — v12 model strong enough not to need it
54
  rescue_bonus = np.array([0.0, 0.0, 0.0], dtype=np.float32)
55
 
56
  iou_thres = 0.40 # per-class NMS (redundant after baked-NMS but safe)
@@ -78,7 +81,7 @@ class Miner:
78
  _ort_type = self.sess.get_inputs()[0].type # "tensor(float16)" or fp32
79
  self.np_dtype = np.float16 if "float16" in _ort_type else np.float32
80
  active = self.sess.get_providers()[0]
81
- print(f"✅ v12 ONNX beverage model loaded (provider={active}, dtype={self.np_dtype.__name__})")
82
 
83
  # Detect output format once
84
  out0 = self.sess.get_outputs()[0]
@@ -89,12 +92,12 @@ class Miner:
89
  try:
90
  dummy = np.zeros((self.input_size, self.input_size, 3), dtype=np.uint8)
91
  _ = self._infer(dummy)
92
- print(f"✅ v12 ONNX warmup pass completed (provider={active})")
93
  except Exception as e:
94
- print(f"⚠️ v12 ONNX warmup pass failed (not fatal): {e}")
95
 
96
  def __repr__(self) -> str:
97
- return f"BeverageONNXv12(in={self.input_size}, cls={self.num_classes})"
98
 
99
  # ---- preprocessing --------------------------------------------------
100
  def _letterbox(self, im: ndarray) -> tuple[ndarray, float]:
 
1
+ # build-rev: 2026-05-28-v14 (yolo11s trained on validator-IDENTICAL SAM3-GT)
2
+ """Open-source Detect-beverage miner v14 (yolo11s trained on SAM3 validator-GT).
3
 
4
+ Trained on 329 frames labelled by the SAME SAM3 endpoint the validator uses to
5
+ build pseudo-GT (prompts cup/bottle/can, thr 0.5, mosaic 0) i.e. the actual
6
+ scoring target, not peer miners' boxes. NMS-baked ONNX, output [1,300,6].
7
+
8
+ On 50 SAM3-GT holdout (validator-target): mAP50=0.715 (navierstocks 0.673,
9
+ v12 0.645); best composite UI 63.47% (nav 62.91%, v12 61.97%). Beats peers on
10
+ detection; parity-plus on composite.
11
 
12
  Post-proc:
13
  - detect NMS-baked output and unpack to (N, 4+num_classes) one-hot scores
14
+ - per-class conf filter `[0.70, 0.50, 0.50]` (best v14 sweep on SAM3-GT)
15
  - sane-box geometric filter (min_box_area=100, max_aspect_ratio=10)
16
  - per-class hard NMS @ iou=0.4 (redundant after baked NMS but safe)
17
+ - cross-class dedup @ iou=0.7 (helps bottle↔can misclassification FP)
18
+ - TTA off
19
 
20
  Contract: class `Miner` at HF root, `predict_batch(...) -> list[TVFrameResult]`.
21
  """
 
51
  input_size = 1280
52
  num_classes = 3 # cup, bottle, can
53
 
54
+ # per-class conf — best v14 sweep on SAM3-GT holdout (composite 63.47%):
55
+ conf_thres = np.array([0.70, 0.50, 0.50], dtype=np.float32)
56
+ # rescue bonus disabled
57
  rescue_bonus = np.array([0.0, 0.0, 0.0], dtype=np.float32)
58
 
59
  iou_thres = 0.40 # per-class NMS (redundant after baked-NMS but safe)
 
81
  _ort_type = self.sess.get_inputs()[0].type # "tensor(float16)" or fp32
82
  self.np_dtype = np.float16 if "float16" in _ort_type else np.float32
83
  active = self.sess.get_providers()[0]
84
+ print(f"✅ v14 ONNX beverage model loaded (provider={active}, dtype={self.np_dtype.__name__})")
85
 
86
  # Detect output format once
87
  out0 = self.sess.get_outputs()[0]
 
92
  try:
93
  dummy = np.zeros((self.input_size, self.input_size, 3), dtype=np.uint8)
94
  _ = self._infer(dummy)
95
+ print(f"✅ v14 ONNX warmup pass completed (provider={active})")
96
  except Exception as e:
97
+ print(f"⚠️ v14 ONNX warmup pass failed (not fatal): {e}")
98
 
99
  def __repr__(self) -> str:
100
+ return f"BeverageONNXv14(in={self.input_size}, cls={self.num_classes})"
101
 
102
  # ---- preprocessing --------------------------------------------------
103
  def _letterbox(self, im: ndarray) -> tuple[ndarray, float]: