scorevision: push artifact
Browse files
miner.py
CHANGED
|
@@ -13,7 +13,7 @@ Repo layout:
|
|
| 13 |
|
| 14 |
Which boxes are sent: with an "esm" block in config.json, the boxes that maximise the EXPECTED validator score
|
| 15 |
(class _Esm below; numbers fitted on our own model by tune_esm.py). Without it, per-class conf thresholds plus
|
| 16 |
-
the first-box rescue.
|
| 17 |
|
| 18 |
No `from __future__ import annotations` here: pydantic must see real types when the
|
| 19 |
chute imports this file dynamically.
|
|
@@ -212,8 +212,8 @@ class Miner:
|
|
| 212 |
q = np.round(boxes).astype(int)
|
| 213 |
ok = (q[:, 2] > q[:, 0]) & (q[:, 3] > q[:, 1])
|
| 214 |
q, conf, cls = q[ok], conf[ok].astype(np.float64), cls[ok]
|
| 215 |
-
if not len(q):
|
| 216 |
-
return []
|
| 217 |
h, w = image.shape[:2]
|
| 218 |
p = self.esm.prob(cls, conf, (q[:, 2] - q[:, 0]) * (q[:, 3] - q[:, 1]) / float(h * w))
|
| 219 |
idxs = [np.flatnonzero(cls == c)[: self.esm.kmax] for c in range(3)] # candidates are sorted by score
|
|
|
|
| 13 |
|
| 14 |
Which boxes are sent: with an "esm" block in config.json, the boxes that maximise the EXPECTED validator score
|
| 15 |
(class _Esm below; numbers fitted on our own model by tune_esm.py). Without it, per-class conf thresholds plus
|
| 16 |
+
the first-box rescue. In both cases nothing is sent when the best candidate scores below "gate".
|
| 17 |
|
| 18 |
No `from __future__ import annotations` here: pydantic must see real types when the
|
| 19 |
chute imports this file dynamically.
|
|
|
|
| 212 |
q = np.round(boxes).astype(int)
|
| 213 |
ok = (q[:, 2] > q[:, 0]) & (q[:, 3] > q[:, 1])
|
| 214 |
q, conf, cls = q[ok], conf[ok].astype(np.float64), cls[ok]
|
| 215 |
+
if not len(q) or float(conf.max()) < self.gate:
|
| 216 |
+
return [] # image-level gate: on an image without objects every box costs 0.1 (E004)
|
| 217 |
h, w = image.shape[:2]
|
| 218 |
p = self.esm.prob(cls, conf, (q[:, 2] - q[:, 0]) * (q[:, 3] - q[:, 1]) / float(h * w))
|
| 219 |
idxs = [np.flatnonzero(cls == c)[: self.esm.kmax] for c in range(3)] # candidates are sorted by score
|