YOLO26n-Crowdhuman-Head-Detection
Single-class head detection trained on CrowdHuman — YOLO26n with an extra P2 small-object detection head (P2·P3·P4·P5 outputs), for dense-crowd scenes.
Model overview
| Task | Object detection (single class: human head) |
| Architecture | YOLO26n + P2/4 detection head (P2·P3·P4·P5 four-scale output) |
| Classes | 0 = head (head boxes from the CrowdHuman hbox annotation) |
| Input | 640×640 (source images letterboxed) |
| Parameters | 2,515,976 |
| Compute | 7.6 GFLOPs @ 640 |
| Weights | Ultralytics PyTorch checkpoint (best.pt, saved by Ultralytics 8.4.211; the ema slot is empty as saved after training — inference loads the final model weights) |
| Framework | Ultralytics ≥ 8.4.211 (the YOLO26 family needs a recent version) |
| Training data | CrowdHuman train split — 15,000 images, 429,366 head boxes |
| Validation data | CrowdHuman val split — 4,370 images, 97,316 head boxes |
Why the extra P2 head: 16.1% of CrowdHuman heads are smaller than 32 px at 640 input. Measured at 640 resolution, a P3–P5-only head returns no candidate box at all for tiny heads (below 0.05% of image area) in 28.7% of images; adding P2 drops that to 7.4% (person boxes: 14.4% → 3.1%). This is the main design rationale for the model family.
Demo
Inference examples (yellow boxes = head, class and confidence printed on each label). These are arbitrary web images, not CrowdHuman samples. Click any image to open it at full resolution.
Performance
Validation metrics (Ultralytics COCO-style mAP, IoU 0.50:0.95)
| Model | P | R | mAP50 | mAP50-95 | Epochs | Best epoch |
|---|---|---|---|---|---|---|
| This model (head-only) | 0.8489 | 0.6748 | 0.7617 | 0.4642 | 130 | 127 |
YOLO26n-P2 joint model (head class) | 0.8630 | 0.6540 | 0.7460 | 0.4420 | 130 | 118 |
Ablation takeaway: on identical data, a dedicated head detector beats joint head+person training (mAP50-95 +0.0222). Heads and persons differ ~4× in scale (16% of heads are <32 px while persons are large objects); one shared anchor assignment serving both scales creates gradient interference, and the head class suffers most.
Inference latency (RTX 4090, 640, max_det=800)
| mean | median | p90 | p99 | max |
|---|---|---|---|---|
| 30.8 ms | 13.9 ms | 99.9 ms | 145.1 ms | 217.3 ms |
Metric caveats (please read)
- These are Ultralytics COCO-style mAP, not the official CrowdHuman AP / mMR protocol (which excludes ignore regions) → not directly comparable with numbers in the official paper.
- CrowdHuman splits train/val by image, not by video; all 10 video IDs appear on both sides → val metrics are optimistic and must not be read as cross-domain generalization.
- CrowdHuman
hbox(andfbox) annotations may extend outside the image; converted YOLO labels are clipped to image bounds.
Quick start
from ultralytics import YOLO
model = YOLO("best.pt") # or the path to this repo's checkpoint
model.names # {0: 'head'}
results = model("your_image.jpg", conf=0.25, iou=0.7, imgsz=640, max_det=700)
for r in results:
for box in r.boxes:
cls = model.names[int(box.cls)] # 'head'
conf = float(box.conf)
x1, y1, x2, y2 = box.xyxy[0].tolist()
Command line:
yolo predict model=best.pt source=your_image.jpg conf=0.25 iou=0.7 imgsz=640 max_det=700
Recommended parameters:
| Parameter | Value | Notes |
|---|---|---|
imgsz | 640 | Training resolution; raise it for better far-field tiny heads, at the cost of memory and latency |
conf | 0.25 | Drop to 0.15 for more boxes in dense scenes; raise to 0.4 if false positives dominate |
iou | 0.7 | NMS IoU; 0.6–0.7 recommended for dense heads |
max_det | 700 | CrowdHuman has up to 619 objects per image; capping at 300 cuts recall |
Training details
| Hyperparameter | Value |
|---|---|
| Optimizer | MuSGD |
| Initial lr | 0.01 (lr0) |
| Batch size | 32 |
| Epochs | 130 (early stop patience 20; best at epoch 127) |
| Augmentation | mosaic 1.0 / scale 0.5 / fliplr 0.5 / translate 0.1 / close_mosaic 10 |
max_det | 700 |
| Seed | 0 (deterministic=True) |
| Hardware | RTX 4090 24 GB, peak VRAM ~22.9 GB |
| Framework | Ultralytics 8.4.211 |

Reproduce from scratch
# 1) Data: CrowdHuman -> YOLO format (head class, hbox)
python crowdhuman_to_yolo.py --odgt annotation_train.odgt \
--images CrowdHuman_train --out-dir CrowdHuman_yolo_single/head --box hbox
# 2) Train
yolo detect train model=yolo26n-p2.yaml pretrained=yolo26n.pt \
data=CrowdHuman_yolo_single/head/data.yaml \
epochs=130 imgsz=640 batch=32 optimizer=MuSGD lr0=0.01 \
patience=20 max_det=700 mosaic=1.0 scale=0.5 close_mosaic=10 fliplr=0.5 \
project=runs name=ch640_head_only
The data conversion script (crowdhuman_to_yolo.py), per-epoch logs (results.csv), PR/F1 curves, confusion matrix, training args (args.yaml), model structure (yolo26n-p2.yaml) and the full source audit are published in the ModelScope mirror of this repo.
Known limitations
- Visible misses in dense far-field scenes: the densest val image has 619 heads, and tiny far-side targets are mostly missed. 640 input is inherently hard here; raising
imgszto 960/1280 helps but costs latency and memory. - Recall is on the low side (R 0.675): heads are small and frequently occluded (a share of official annotations is marked
head_attr.ignore). - No cross-domain guarantee: train/val share video IDs, so val metrics are optimistic.
- No cross-class NMS: this model only outputs
head, so there is no cross-class conflict by construction.
Dataset & license
- Dataset: CrowdHuman (arXiv:1805.00123), original project: https://www.crowdhuman.org/.
- Dataset license: CC BY-NC 4.0 — non-commercial research / educational use only. The weights in this repo inherit this restriction and must not be used commercially; do not redistribute the original CrowdHuman images.
- The repo also follows Ultralytics AGPL-3.0 (YOLO26 architecture and
best.ptformat).
Citation
@inproceedings{shao2018crowdhuman,
title = {CrowdHuman: A Benchmark for Detecting Human in a Crowd},
author = {Shao, Liang and Huang, Zicheng and Wang, Jian and others},
booktitle = {European Conference on Computer Vision (ECCV)},
year = {2018}
}
@article{ultralyticsyolo26,
title = {Ultralytics YOLO26},
journal = {Ultralytics Documentation},
url = {https://docs.ultralytics.com/models/yolo26}
}