scorevision: push artifact
Browse files
README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Detect-Person miner (element `manak0/Detect-Person`)
|
| 2 |
+
|
| 3 |
+
Public-track TurboVision miner: single-class person detection.
|
| 4 |
+
Base model: YOLO11n (COCO-pretrained, ~5.6 MB — well under the 30 MB element cap),
|
| 5 |
+
filtered to the person class, emitted with `cls_id=0`.
|
| 6 |
+
|
| 7 |
+
Element constraints (from the live manifest):
|
| 8 |
+
|
| 9 |
+
- pillars: map50 x0.6 + false_positive x0.4 (false_positive = 1 - FPs-per-image/10)
|
| 10 |
+
- baseline theta to beat: ~0.368
|
| 11 |
+
- p95 latency <= 100 ms/frame on 2 vCPU (automated compliance loop)
|
| 12 |
+
- max model size 30 MB; validator preproc: 5 fps, long side 1280, rgb-01
|
| 13 |
+
|
| 14 |
+
## Files
|
| 15 |
+
|
| 16 |
+
- `miner.py` — required entrypoint (`Miner.predict_batch`), prefers `person.onnx` over `yolo11n.pt`
|
| 17 |
+
- `chute_config.yml` — Chutes image/runtime config
|
| 18 |
+
- `yolo11n.pt` — base weights (replace with fine-tuned weights to beat other miners)
|
| 19 |
+
- `export_onnx.py` — exports `person.onnx` for faster CPU inference
|
| 20 |
+
- `benchmark_latency.py` — local replica of the 2 vCPU / 100 ms p95 latency gate
|
| 21 |
+
|
| 22 |
+
## Workflow
|
| 23 |
+
|
| 24 |
+
```bash
|
| 25 |
+
# from the repo root, with the uv venv active (uv sync already done)
|
| 26 |
+
cd my_miners/detect_person
|
| 27 |
+
|
| 28 |
+
# 1. ONNX export (required for CPU speed; .pt alone fails the latency gate)
|
| 29 |
+
python export_onnx.py --imgsz 480
|
| 30 |
+
|
| 31 |
+
# 2. latency gate check, pinned to 2 CPUs like the compliance loop
|
| 32 |
+
taskset -c 0,1 python benchmark_latency.py --frames 100 --imgsz 480
|
| 33 |
+
|
| 34 |
+
# 3. deploy: upload to HF, build chute, warm + health-check, commit on-chain
|
| 35 |
+
cd ../..
|
| 36 |
+
sv -v deploy-os-miner --model-path my_miners/detect_person --element-id manak0/Detect-Person
|
| 37 |
+
|
| 38 |
+
# dry-run variants
|
| 39 |
+
sv -v deploy-os-miner --model-path my_miners/detect_person --element-id manak0/Detect-Person --no-commit
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Required `.env` (see repo README.md): `BITTENSOR_WALLET_COLD`, `BITTENSOR_WALLET_HOT`,
|
| 43 |
+
`CHUTES_API_KEY`, `HF_USER`, `HF_TOKEN`, `CHUTES_HF_TOKEN` (read-only fine-grained token),
|
| 44 |
+
`SCOREVISION_NETUID=44`. Hotkey must be registered on netuid 44.
|
| 45 |
+
|
| 46 |
+
## Measured latency (this machine, taskset 2 CPUs, 60 frames)
|
| 47 |
+
|
| 48 |
+
| Model | imgsz | p50 | p95 | Gate (<=100 ms p95) |
|
| 49 |
+
|---|---|---|---|---|
|
| 50 |
+
| yolo11n.pt (torch CPU) | 640 | 131 ms | 150 ms | FAIL |
|
| 51 |
+
| person.onnx | 640 | 98 ms | 145 ms | FAIL |
|
| 52 |
+
| person.onnx | 512 | 57 ms | 92 ms | pass (thin margin) |
|
| 53 |
+
| person.onnx | 480 | 52 ms | 78 ms | PASS (default) |
|
| 54 |
+
|
| 55 |
+
The compliance CPU model is unknown, so the 480 export is the default for
|
| 56 |
+
headroom. Re-export at 512 only if you accept the thinner margin.
|
| 57 |
+
|
| 58 |
+
## Tuning notes
|
| 59 |
+
|
| 60 |
+
- `SV_CONF_THRESHOLD` (default 0.35): raise to cut false positives (each FP/image
|
| 61 |
+
costs 0.1 on the 0.4-weighted FP pillar), lower to lift recall/mAP.
|
| 62 |
+
- The dataset is synthetic (SAM3-annotated, 302 images). COCO-pretrained YOLO11n
|
| 63 |
+
should clear the ~0.368 baseline; to win the element, fine-tune on person data
|
| 64 |
+
matching the synthetic distribution and drop the weights in as `yolo11n.pt`
|
| 65 |
+
(or re-export `person.onnx`).
|
| 66 |
+
- Commit early: on-chain commit block is the tie-breaker under model-copy protection.
|