YOLO-face-detection320

Four nano-scale YOLO face detectors. Fixed 320×320 input, single class face. All four were trained on the same dataset with the same recipe, so they can be compared directly.

Demo images

Each panel is one image: the output of yolov8n-face320.pt, the number on the box is the confidence. Params: imgsz=320, conf=0.25, iou=0.5. Run on CPU with ultralytics 8.3.51 — no cherry-picking, no post-processing.

iu 188×268 · 1 face · conf 0.96

iu · 188×268 · 1 face · box covers 13.4% of the frame · conf 0.961

images 556×552 · 1 face · conf 0.93

images · 556×552 · 1 face · box covers 22.8% of the frame · conf 0.931

licensed-image 2048×1365 · 1 face · conf 0.93

licensed-image · 2048×1365 · 1 face · box covers 22.6% of the frame · conf 0.925 (downscaled to 320 for inference; the face still spans ~23% of the frame — the model's comfort zone)

lyf 381×524 · 1 face · conf 0.96

lyf · 381×524 · 1 face · box covers 15.8% of the frame · conf 0.964

talyor 452×678 · 1 face · conf 0.95

talyor · 452×678 · 1 face · box covers 12.6% of the frame · conf 0.950

Each image holds a single face. Re-running the set at conf=0.10 returned the same count (1 each) for yolov8n, yolo11n and yolov5nu. yolo26n adds a second low-confidence box on two images (images 0.30, licensed-image 0.14) — genuine extra candidates that the 0.25 threshold filters out.

When to use it

These weights are built for small inputs where the face takes up a large share of the frame. The input is a fixed 320×320, and the intended subject is one face (or a head-and-shoulders shot) filling most of the image: ID photos, avatars, access-control / gate captures, cropped portraits. The demo above sits in the 12%–22% box-to-frame range, which is where the model is most reliable.

Conversely, tiny distant faces (ground-truth box < 0.4% of the frame) only reach ~0.73 recall — that is not what these weights are for. Tile large images and run 320 on each tile, or train a 640 model.

Training data

Item Value
Classes 1: face
Train set 23,150 images / 24,575 boxes
Val set 5,797 images / 6,146 boxes
Total boxes 30,721
Image size mostly native 320×320 (25,845 / 28,947); train and val both at 320, no resizing
Labels produced by an automatic detector, not hand-verified box by box
Split official split; train/val verified free of duplicate images (md5 + perceptual hash)

Results

All measured on the same val set (5,797 images / 6,146 boxes), imgsz=320, conf=0.001, COCO-style metrics:

Model File Params GFLOPs Size P R mAP50 mAP50-95 b1 (ms) b1 FPS b32 FPS
yolov8n-face320.pt 6.50 MB 3.138 M 2.19 6.5 MB 0.9908 0.9796 0.9931 0.9142 4.39 228 3646
yolo11n-face320.pt 5.51 MB 2.605 M 1.63 5.5 MB 0.9913 0.9789 0.9929 0.9147 5.59 179 3106
yolo26n-face320.pt 5.47 MB 2.534 M 1.48 5.5 MB 0.9900 0.9797 0.9930 0.9140 6.41 156 2886
yolov5nu-face320.pt 5.53 MB 2.636 M 1.93 5.5 MB 0.9927 0.9795 0.9932 0.9138 4.68 214 3580
  • Speed: RTX 4090, FP16, full path including preprocess + forward + NMS, median of 7 runs.
  • Accuracy: pairwise differences across the four models were tested with a 1000-round paired bootstrap; every 95% CI crosses zero — no measurable accuracy difference, so pick by speed and size.
  • yolov5nu is Ultralytics' port of YOLOv5n (2.64 M params), not the 1.77 M model from the original YOLOv5 repo.

Inference

from ultralytics import YOLO

model = YOLO("yolo26n-face320.pt")
results = model.predict("image.jpg", imgsz=320, conf=0.25, iou=0.5)
for b in results[0].boxes:
    print(b.xyxy.tolist(), float(b.conf))
yolo predict model=yolo26n-face320.pt source=./images imgsz=320 conf=0.25

Caveats

  • Input must be 320. Running a 320-trained model at 640 drops mAP50-95 from 0.914 to 0.775 — do not upscale the input.
  • The box is the face region (hairline to chin), excluding the back of the head and neck. If downstream needs a full-head box, redefine it there.
  • Weak on small targets: recall ~0.73 for GT boxes < 0.4% of the frame, ~0.77 for 0.4–2%, 0.998 above 10%. For distant small faces, tile the image or train a 640 model.
  • Of the misses, 88.5% are complete non-responses (not sloppy boxes), and ~32% are "detected but below 0.25"; lowering conf to ~0.15 recovers about a third of them at the cost of more false positives.
  • The training set is dominated by single-face images (only 5.5% have multiple faces); dense crowds are out of distribution.

Training setup

Item Value
epochs 150
batch 256
imgsz 320
optimizer auto (MuSGD with lr 0.01 when iterations > 10000)
augmentation defaults (mosaic 1.0, scale 0.5, fliplr 0.5; mosaic off for the last 10 epochs)
seed 0, deterministic=True
stack Ultralytics 8.4.211 / torch 2.11.0+cu130
Per-model training time 41–49 min (RTX 4090)

License

AGPL-3.0 (inherited from Ultralytics).

Downloads last month
174
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for wesjos/YOLO-face-detection320

Finetuned
(214)
this model

Collection including wesjos/YOLO-face-detection320