Upload folder using huggingface_hub
Browse files- miner.py +14 -3
- weights.onnx +2 -2
miner.py
CHANGED
|
@@ -113,7 +113,7 @@ class Miner:
|
|
| 113 |
self.max_det = 200
|
| 114 |
# TTA = a 2nd (flipped) forward pass. Doubles latency; off for the
|
| 115 |
# CPU latency gate. Re-enable only if the latency budget allows.
|
| 116 |
-
self.use_tta =
|
| 117 |
|
| 118 |
# conf thresholds: broom=0.38 drainage gate=0.45 nozzle=0.30 track=0.60
|
| 119 |
# Per-class confidence thresholds.
|
|
@@ -123,7 +123,7 @@ class Miner:
|
|
| 123 |
# 0.5/0.5 silently discarded many valid detections); track is the
|
| 124 |
# one class where false fires are common enough to need 0.38.
|
| 125 |
self._conf_thres_array = np.array(
|
| 126 |
-
[0.
|
| 127 |
)
|
| 128 |
# Per-class rescue bonus: when a class has ZERO boxes passing the
|
| 129 |
# threshold in a frame, its top-1 candidate is admitted when its score
|
|
@@ -131,7 +131,7 @@ class Miner:
|
|
| 131 |
# DISABLED (all zeros): the sweep showed rescue admits more false
|
| 132 |
# positives than true positives under the validator's FP pillar.
|
| 133 |
self._bonus_array = np.array(
|
| 134 |
-
[0.05, 0.1, 0.
|
| 135 |
)
|
| 136 |
|
| 137 |
# Box sanity filter — kept loose: car-wash `nozzle` boxes are tiny
|
|
@@ -145,6 +145,17 @@ class Miner:
|
|
| 145 |
print(f"✅ ONNX providers: {self.session.get_providers()}")
|
| 146 |
print(f"✅ ONNX input: name={self.input_name}, shape={self.input_shape}")
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
def __repr__(self) -> str:
|
| 149 |
return (
|
| 150 |
f"ONNXRuntime(session={type(self.session).__name__}, "
|
|
|
|
| 113 |
self.max_det = 200
|
| 114 |
# TTA = a 2nd (flipped) forward pass. Doubles latency; off for the
|
| 115 |
# CPU latency gate. Re-enable only if the latency budget allows.
|
| 116 |
+
self.use_tta = False
|
| 117 |
|
| 118 |
# conf thresholds: broom=0.38 drainage gate=0.45 nozzle=0.30 track=0.60
|
| 119 |
# Per-class confidence thresholds.
|
|
|
|
| 123 |
# 0.5/0.5 silently discarded many valid detections); track is the
|
| 124 |
# one class where false fires are common enough to need 0.38.
|
| 125 |
self._conf_thres_array = np.array(
|
| 126 |
+
[0.32, 0.3, 0.45, 0.3], dtype=np.float32
|
| 127 |
)
|
| 128 |
# Per-class rescue bonus: when a class has ZERO boxes passing the
|
| 129 |
# threshold in a frame, its top-1 candidate is admitted when its score
|
|
|
|
| 131 |
# DISABLED (all zeros): the sweep showed rescue admits more false
|
| 132 |
# positives than true positives under the validator's FP pillar.
|
| 133 |
self._bonus_array = np.array(
|
| 134 |
+
[0.05, 0.1, 0.1, 0.1], dtype=np.float32
|
| 135 |
)
|
| 136 |
|
| 137 |
# Box sanity filter — kept loose: car-wash `nozzle` boxes are tiny
|
|
|
|
| 145 |
print(f"✅ ONNX providers: {self.session.get_providers()}")
|
| 146 |
print(f"✅ ONNX input: name={self.input_name}, shape={self.input_shape}")
|
| 147 |
|
| 148 |
+
self._warmup()
|
| 149 |
+
|
| 150 |
+
def _warmup(self, iters: int = 3) -> None:
|
| 151 |
+
try:
|
| 152 |
+
dummy = np.zeros((720, 1280, 3), dtype=np.uint8)
|
| 153 |
+
for _ in range(max(1, iters)):
|
| 154 |
+
self.predict_batch(batch_images=[dummy], offset=0, n_keypoints=0)
|
| 155 |
+
print(f"✅ warmup: {iters} dummy predict_batch call(s) done")
|
| 156 |
+
except Exception as e:
|
| 157 |
+
print(f"⚠️ warmup skipped: {e}")
|
| 158 |
+
|
| 159 |
def __repr__(self) -> str:
|
| 160 |
return (
|
| 161 |
f"ONNXRuntime(session={type(self.session).__name__}, "
|
weights.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:020517c8e4ddd15a3a655fc794aa69bbda6032b328feb2749ef917c92b27b50f
|
| 3 |
+
size 9881386
|