File size: 3,869 Bytes
1e772f5
 
d309134
 
 
 
 
 
 
1e772f5
d309134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
license: cc-by-nc-4.0
base_model:
- Ultralytics/YOLO11
tags:
- computer vision
- head detection
- object detection
- multi-object tracking
---

# HeadTracking (YOLO11m head detector + BoT-SORT tracker)

HeadTracking detects and tracks human heads in the wild in images and videos. The detector is a YOLO11m model fine-tuned on a merge of seven public head-annotation datasets (~43k images, ~1M heads). It detects whole heads (not only faces), which is useful for downstream tasks such as head pose estimation and gaze tracking in challenging scenarios. A BoT-SORT tracker configuration is provided to link detections into head tracks across video frames.
* `yolo11m_merged.torchscript`: head detector weights (TorchScript)
* `botsort_custom.yaml`: BoT-SORT tracker configuration for Ultralytics


## Overview

* **Training**: HeadTracking was trained on the following datasets:
  * [Human Head Detection (CCTV)](https://universe.roboflow.com/trisha-then/head-detection-cctv): ~1.9k images.
  * [CrowdHuman](https://www.crowdhuman.org/): ~19k images. 
  * [Fudan-ShanghaiTech](https://github.com/sweetyy83/Lstn_fdst_dataset): ~1.1k images.
  * [Human Head Detection OpenVM + C270](https://www.kaggle.com/datasets/hoangxuanviet/human-head-detection-openvm-c270): ~1.8k images.
  * [S-Head](https://www.kaggle.com/datasets/hoangxuanviet/data-s-head): ~2.7k images.
  * [SCUT-HEAD](https://github.com/HCIILAB/SCUT-HEAD-Dataset-Release): ~3.8k images. 
  * [VSCrowd](https://huggingface.co/datasets/HopLeeTop/VSCrowd): ~12.6k images. 
* **Backbone**:
  * HeadTracking is based on [YOLO11m (Ultralytics)](https://github.com/ultralytics/ultralytics)
  * Tracker: BoT-SORT
* **Parameters**: ~20 million
* **Task**: Head detection in images and multi-head tracking in videos.
* **Framework**: PyTorch (TorchScript) / Ultralytics
* **Output structure**: Per frame, per detected head:
  * `xyxy` (4,): bounding box [x1, y1, x2, y2] in pixels
  * `conf` (1,): detection confidence
  * `id` (1,): track ID (tracking only)


## Model performance

mAP50 on the test split of each dataset:

| Model | CCTV | CrowdHuman | Fudan-ShanghaiTech | OpenVM | S-Head | SCUT Head | VSCrowd |
|---|---|---|---|---|---|---|---|
| yolov5m_crowdhuman (reference) | 0.589 | 0.713 | 0.864 | 0.485 | 0.429 | 0.709 | 0.035 |
| **yolo11m_merged (released)** | **0.990** | **0.748** | **0.921** | **0.983** | **0.987** | **0.962** | **0.172** |


## Running Code

Minimal code to instantiate the model and perform inference:
```
import cv2
from ultralytics import YOLO

model = YOLO("yolo11m_merged.torchscript", task="detect")

cap = cv2.VideoCapture("my_video.mp4")
while True:
    success, frame = cap.read()
    if not success:
        break

    results = model.track(
        frame,
        tracker="botsort_custom.yaml",
        persist=True,  # keep track IDs across frames
        conf=0.5,
        iou=0.5,
        classes=[0],   # head class
        verbose=False,
    )

    boxes = results[0].boxes
    if boxes.id is not None:
        head_ids = boxes.id.int().tolist()    # track ID per head
        head_bboxes = boxes.xyxy.tolist()     # [x1, y1, x2, y2] in pixels
        confs = boxes.conf.tolist()           # detection confidence

cap.release()
```


## License

HeadTracking is released under [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/deed.en)

## Copyright 

(c) 2025 Idiap Research Institute


## Citation

If you find our work useful, please cite the following publication:

```bibtex
@techreport{dewaha2025headdetection,
  title       = {Towards Better Head Detection: A Comparative Analysis of YOLO and DETR Architectures with Dataset Scaling},
  author      = {de Waha, Gilles and Tafasca, Samy and Odobez, Jean-Marc},
  institution = {Idiap Research Institute / EPFL},
  type        = {Project report},
  year        = {2025},
  month       = jan
}
```