File size: 2,914 Bytes
f839f40 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # 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.
|