ScoreVision / README.md
dev0524's picture
scorevision: push artifact
f839f40 verified
|
Raw History Blame Contribute Delete
2.91 kB
# Detect-Person miner (element `manak0/Detect-Person`)
Public-track TurboVision miner: single-class person detection.
Base model: YOLO11n (COCO-pretrained, ~5.6 MB β€” well under the 30 MB element cap),
filtered to the person class, emitted with `cls_id=0`.
Element constraints (from the live manifest):
- pillars: map50 x0.6 + false_positive x0.4 (false_positive = 1 - FPs-per-image/10)
- baseline theta to beat: ~0.368
- p95 latency <= 100 ms/frame on 2 vCPU (automated compliance loop)
- max model size 30 MB; validator preproc: 5 fps, long side 1280, rgb-01
## Files
- `miner.py` β€” required entrypoint (`Miner.predict_batch`), prefers `person.onnx` over `yolo11n.pt`
- `chute_config.yml` β€” Chutes image/runtime config
- `yolo11n.pt` β€” base weights (replace with fine-tuned weights to beat other miners)
- `export_onnx.py` β€” exports `person.onnx` for faster CPU inference
- `benchmark_latency.py` β€” local replica of the 2 vCPU / 100 ms p95 latency gate
## Workflow
```bash
# from the repo root, with the uv venv active (uv sync already done)
cd my_miners/detect_person
# 1. ONNX export (required for CPU speed; .pt alone fails the latency gate)
python export_onnx.py --imgsz 480
# 2. latency gate check, pinned to 2 CPUs like the compliance loop
taskset -c 0,1 python benchmark_latency.py --frames 100 --imgsz 480
# 3. deploy: upload to HF, build chute, warm + health-check, commit on-chain
cd ../..
sv -v deploy-os-miner --model-path my_miners/detect_person --element-id manak0/Detect-Person
# dry-run variants
sv -v deploy-os-miner --model-path my_miners/detect_person --element-id manak0/Detect-Person --no-commit
```
Required `.env` (see repo README.md): `BITTENSOR_WALLET_COLD`, `BITTENSOR_WALLET_HOT`,
`CHUTES_API_KEY`, `HF_USER`, `HF_TOKEN`, `CHUTES_HF_TOKEN` (read-only fine-grained token),
`SCOREVISION_NETUID=44`. Hotkey must be registered on netuid 44.
## Measured latency (this machine, taskset 2 CPUs, 60 frames)
| Model | imgsz | p50 | p95 | Gate (<=100 ms p95) |
|---|---|---|---|---|
| yolo11n.pt (torch CPU) | 640 | 131 ms | 150 ms | FAIL |
| person.onnx | 640 | 98 ms | 145 ms | FAIL |
| person.onnx | 512 | 57 ms | 92 ms | pass (thin margin) |
| person.onnx | 480 | 52 ms | 78 ms | PASS (default) |
The compliance CPU model is unknown, so the 480 export is the default for
headroom. Re-export at 512 only if you accept the thinner margin.
## Tuning notes
- `SV_CONF_THRESHOLD` (default 0.35): raise to cut false positives (each FP/image
costs 0.1 on the 0.4-weighted FP pillar), lower to lift recall/mAP.
- The dataset is synthetic (SAM3-annotated, 302 images). COCO-pretrained YOLO11n
should clear the ~0.368 baseline; to win the element, fine-tune on person data
matching the synthetic distribution and drop the weights in as `yolo11n.pt`
(or re-export `person.onnx`).
- Commit early: on-chain commit block is the tie-breaker under model-copy protection.