YOLO26n-Crowdhuman-Head-FullBody-Detection
Joint head + full-body detection trained on CrowdHuman — YOLO26n with an extra P2 small-object detection head (P2·P3·P4·P5 outputs). The only model of the family that outputs both classes in a single pass.
Model overview
| Task | Object detection (two classes: human head + full body) |
| Architecture | YOLO26n + P2/4 detection head (P2·P3·P4·P5 four-scale output) |
| Classes | 0 = head (head boxes, hbox) · 1 = person (full-body boxes, fbox) |
| Input | 640×640 (source images letterboxed) |
| Parameters | 2,516,240 |
| 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, 332,050 head boxes + 339,565 person boxes |
| Validation data | CrowdHuman val split — 4,370 images, 97,316 head boxes + 99,481 person 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%).
Demo
Inference examples — yellow boxes, small = head, large = person; 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)
Overall (two-class average)
| Model | P | R | mAP50 | mAP50-95 | Epochs | Best epoch |
|---|---|---|---|---|---|---|
| This model (joint) | 0.8577 | 0.7058 | 0.8006 | 0.4876 | 130 | 118 |
Per class
| Class | P | R | mAP50 | mAP50-95 |
|---|---|---|---|---|
head | 0.8630 | 0.6540 | 0.7460 | 0.4420 |
person | 0.8520 | 0.7570 | 0.8550 | 0.5340 |
Ablation vs the two single-class models (same class, same denominator)
| Class | This model (joint) | Dedicated single-class model | Δ | Takeaway |
|---|---|---|---|---|
head | 0.4420 | 0.4642 (Head-Detection) | +0.0222 for single-class | joint person supervision is negative transfer for heads |
person | 0.5340 | 0.5360 (FullBody-Detection) | +0.0020 for single-class | essentially a tie |
Takeaway: if your deployment needs only heads or only persons, prefer the dedicated single-class model; this joint model earns its keep only when you need both box types from a single inference pass.
Inference latency (RTX 4090, 640, max_det=800)
| mean | median | p90 | p99 | max |
|---|---|---|---|---|
| 30.8 ms | 13.8 ms | 100.7 ms | 145.2 ms | 218.8 ms |
Nearly identical to both single-class models (30.8 / 31.0 / 30.8 ms mean) → the joint model pays no extra latency.
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
fbox/hboxannotations may extend outside the image; converted YOLO labels are clipped to image bounds. - Do not subtract the two-class-average mAP50-95 from a single-class model's mAP50-95 — different denominators, guaranteed wrong conclusion.
Quick start
from ultralytics import YOLO
model = YOLO("best.pt")
model.names # {0: 'head', 1: 'person'}
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_id = int(box.cls)
cls = model.names[cls_id] # 'head' or 'person'
conf = float(box.conf)
x1, y1, x2, y2 = box.xyxy[0].tolist()
Filter to one class:
heads = [b for b in r.boxes if int(b.cls) == 0]
people = [b for b in r.boxes if int(b.cls) == 1]
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 | 48 |
| Epochs | 130 (early stop patience 20; best at epoch 118) |
| 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 |
| Schedule | First 100 epochs + a resumed fine-tune from epoch 100 to 130 (the resume window reset the early-stop counter) |

Reproduce from scratch
# 1) Data: CrowdHuman -> YOLO format (two classes: 0=head hbox, 1=person fbox)
python crowdhuman_to_yolo.py --odgt annotation_train.odgt \
--images CrowdHuman_train --out-dir CrowdHuman_yolo2 --box both
# 2) Train
yolo detect train model=yolo26n-p2.yaml pretrained=yolo26n.pt \
data=CrowdHuman_yolo2/data.yaml \
epochs=130 imgsz=640 batch=48 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_p2_640
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
- Joint training is negative transfer for heads: the
headclass mAP50-95 is 0.0222 below the dedicated head detector (0.4420 vs 0.4642). If you don't need person boxes in the same pass, use the single-class head model. - Visible misses in dense far-field scenes: the densest val image has 619 objects, and far-side small targets are mostly missed. 640 input is inherently hard here.
- Head recall is on the low side (0.654): 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: one person's
headbox andpersonbox are both emitted independently; the coordinates differ, which is expected behavior.
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}
}