Skip to content

Add SCRFD detector as alternative to CenterFace - #78

Open
nick8592 wants to merge 6 commits into
ORB-HD:masterfrom
nick8592:feature/scrfd-detector
Open

nick8592 wants to merge 6 commits into
ORB-HD:masterfrom
nick8592:feature/scrfd-detector

Conversation

@nick8592

@nick8592 nick8592 commented Aug 26, 2026 •

Copy link
Copy Markdown

Summary

Add SCRFD (Sample and Computation Redistribution for Face Detection) as an alternative face detection backend, selectable via a --detector CLI flag. CenterFace remains available and unchanged.

Motivation

Offering a choice of detector backends lets users pick the best option for their use case. SCRFD is a more recent model (ICLR 2022) with an active upstream (InsightFace), while CenterFace remains a proven, lightweight option.

Changes

  • New: deface/scrfd.py — SCRFD detector class with same (dets, lms) interface as CenterFace
  • New: deface/scrfd_10g.onnx — SCRFD 10GFlops ONNX model (17MB, from InsightFace buffalo_l pack)
  • New: examples/city_anonymized_*_scrfd.jpg — SCRFD example outputs for README comparison
  • Modified: deface/deface.py — Add --detector {centerface,scrfd} CLI flag (default: scrfd), rename centerface param to detector
  • Modified: pyproject.toml — Include scrfd_10g.onnx in package data
  • Modified: deface.spec — Include scrfd_10g.onnx in PyInstaller datas
  • Modified: README.md — SCRFD section, detector comparison table, side-by-side example images

How it works

SCRFD uses an FPN architecture with distance-based bounding box and keypoint decoding (3 FPN strides: 8, 16, 32; 2 anchors per location; 5 keypoints). The bundled scrfd_10g.onnx is the 10GFlops variant from the InsightFace buffalo_l model pack, trained on the WIDER FACE dataset.

Testing

Test Result
SCRFD + blur ✅
SCRFD + solid boxes ✅
SCRFD + mosaic ✅
SCRFD + draw-scores ✅
CenterFace backward compat (--detector centerface) ✅
Both opencv and onnxrt backends ✅
test_examples.sh passes ✅
Detection count: SCRFD vs CenterFace on examples/city.jpg 26 vs 25

Benchmark comparison (WIDER FACE validation set mAP)

Model Easy Medium Hard FLOPs Params
SCRFD-10G 95.16 93.87 83.05 10G 3.86M
CenterFace 93.5 92.4 87.5 — —

SCRFD numbers from arXiv:2105.04714 Table 4 (VGA 640×480). CenterFace numbers from arXiv:1911.03599.

Backward compatibility

  • --detector centerface restores the original CenterFace behavior
  • All existing CLI flags unchanged
  • centerface.py untouched
  • get_anonymized_image() now uses SCRFD by default (same public API)

Credits

- Generate SCRFD output images for blur, boxes, mosaic, and draw-scores
- Update README header to 3-column comparison: Original vs CenterFace vs SCRFD
- Add side-by-side CenterFace vs SCRFD comparisons for boxes, mosaic, and scores
- Remove "higher recall" and "legacy" claims from README
- Add CenterFace WIDER FACE numbers to benchmark table
- Replace SCRFD-2.5G row with CenterFace row for fair comparison
- Change image comparison headers from "CenterFace (legacy)" to "CenterFace"
@nick8592
nick8592 force-pushed the feature/scrfd-detector branch from a1bc402 to 4337a5c Compare August 26, 2026 07:31
@nick8592 nick8592 changed the title Replace CenterFace with SCRFD detector for improved face detection recall Add SCRFD detector as alternative to CenterFace Aug 26, 2026
SCRFD paper only reports validation set (95.16/93.87/83.05), not test set.
CenterFace val-set numbers are 93.5/92.4/87.5 (from arXiv:1911.03599).
Previous table mixed SCRFD val numbers with CenterFace test numbers (93.2/92.1/87.3),
which is an apples-to-oranges comparison. Add footnote citing sources and resolution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant