Sample and Computation Redistribution for Efficient Face Detection

Overview

Introduction

SCRFD is an efficient high accuracy face detection approach which initially described in Arxiv.

prcurve

Performance

Precision, flops and infer time are all evaluated on VGA resolution.

ResNet family

Method Backbone Easy Medium Hard #Params(M) #Flops(G) Infer(ms)
DSFD (CVPR19) ResNet152 94.29 91.47 71.39 120.06 259.55 55.6
RetinaFace (CVPR20) ResNet50 94.92 91.90 64.17 29.50 37.59 21.7
HAMBox (CVPR20) ResNet50 95.27 93.76 76.75 30.24 43.28 25.9
TinaFace (Arxiv20) ResNet50 95.61 94.25 81.43 37.98 172.95 38.9
- - - - - - - -
ResNet-34GF ResNet50 95.64 94.22 84.02 24.81 34.16 11.8
SCRFD-34GF Bottleneck Res 96.06 94.92 85.29 9.80 34.13 11.7
ResNet-10GF ResNet34x0.5 94.69 92.90 80.42 6.85 10.18 6.3
SCRFD-10GF Basic Res 95.16 93.87 83.05 3.86 9.98 4.9
ResNet-2.5GF ResNet34x0.25 93.21 91.11 74.47 1.62 2.57 5.4
SCRFD-2.5GF Basic Res 93.78 92.16 77.87 0.67 2.53 4.2

Mobile family

Method Backbone Easy Medium Hard #Params(M) #Flops(G) Infer(ms)
RetinaFace (CVPR20) MobileNet0.25 87.78 81.16 47.32 0.44 0.802 7.9
FaceBoxes (IJCB17) - 76.17 57.17 24.18 1.01 0.275 2.5
- - - - - - - -
MobileNet-0.5GF MobileNetx0.25 90.38 87.05 66.68 0.37 0.507 3.7
SCRFD-0.5GF Depth-wise Conv 90.57 88.12 68.51 0.57 0.508 3.6

X64 CPU Performance of SCRFD-0.5GF:

Test-Input-Size CPU Single-Thread Easy Medium Hard
Original-Size(scale1.0) - 90.91 89.49 82.03
640x480 28.3ms 90.57 88.12 68.51
320x240 11.4ms - - -

precision and infer time are evaluated on AMD Ryzen 9 3950X, using the simple PyTorch CPU inference by setting OMP_NUM_THREADS=1 (no mkldnn).

Installation

Please refer to mmdetection for installation.

  1. Install mmcv. (mmcv-full==1.2.6 and 1.3.3 was tested)
  2. Install build requirements and then install mmdet.
    pip install -r requirements/build.txt
    pip install -v -e .  # or "python setup.py develop"
    

Pretrained-Models

Name Easy Medium Hard FLOPs Params(M) Infer(ms) Link
SCRFD_500M 90.57 88.12 68.51 500M 0.57 3.6 download
SCRFD_1G 92.38 90.57 74.80 1G 0.64 4.1 download
SCRFD_2.5G 93.78 92.16 77.87 2.5G 0.67 4.2 download
SCRFD_10G 95.16 93.87 83.05 10G 3.86 4.9 download
SCRFD_34G 96.06 94.92 85.29 34G 9.80 11.7 download
SCRFD_500M_KPS 90.97 88.44 69.49 500M 0.57 3.6 download
SCRFD_2.5G_KPS 93.80 92.02 77.13 2.5G 0.82 4.3 download
SCRFD_10G_KPS 95.40 94.01 82.80 10G 4.23 5.0 download

mAP, FLOPs and inference latency are all evaluated on VGA resolution. _KPS means the model includes 5 keypoints prediction.

Convert to ONNX

Please refer to tools/scrfd2onnx.py

Generated onnx model can accept dynamic input as default.

You can also set specific input shape by pass --shape 640 640, then output onnx model can be optimized by onnx-simplifier.

Inference

Put your input images or videos in ./input directory. The output will be saved in ./output directory. In root directory of project, run the following command for image:

python inference_image.py --input "./input/test.jpg"

and for video:

python inference_video.py --input "./input/obama.mp4"

Use -sh for show results during code running or not

Note that you can pass some other arguments. Take a look at inference_video.py file.

You might also like...
Scientific Computation Methods in C and Python (Open for Hacktoberfest 2021)

Sci - cpy README is a stub. Do expand it. Objective This repository is meant to be a ready reference for scientific computation methods. Do ⭐ it if yo

A pure PyTorch batched computation implementation of "CIF: Continuous Integrate-and-Fire for End-to-End Speech Recognition"

A pure PyTorch batched computation implementation of "CIF: Continuous Integrate-and-Fire for End-to-End Speech Recognition"

[TIP 2021] SADRNet: Self-Aligned Dual Face Regression Networks for Robust 3D Dense Face Alignment and Reconstruction
[TIP 2021] SADRNet: Self-Aligned Dual Face Regression Networks for Robust 3D Dense Face Alignment and Reconstruction

SADRNet Paper link: SADRNet: Self-Aligned Dual Face Regression Networks for Robust 3D Dense Face Alignment and Reconstruction Requirements python

Realtime Face Anti Spoofing with Face Detector based on Deep Learning using Tensorflow/Keras and OpenCV
Realtime Face Anti Spoofing with Face Detector based on Deep Learning using Tensorflow/Keras and OpenCV

Realtime Face Anti-Spoofing Detection 🤖 Realtime Face Anti Spoofing Detection with Face Detector to detect real and fake faces Please star this repo

A large-scale face dataset for face parsing, recognition, generation and editing.
A large-scale face dataset for face parsing, recognition, generation and editing.

CelebAMask-HQ [Paper] [Demo] CelebAMask-HQ is a large-scale face image dataset that has 30,000 high-resolution face images selected from the CelebA da

aka
aka "Bayesian Methods for Hackers": An introduction to Bayesian methods + probabilistic programming with a computation/understanding-first, mathematics-second point of view. All in pure Python ;)

Bayesian Methods for Hackers Using Python and PyMC The Bayesian method is the natural approach to inference, yet it is hidden from readers behind chap

Deep learning with dynamic computation graphs in TensorFlow
Deep learning with dynamic computation graphs in TensorFlow

TensorFlow Fold TensorFlow Fold is a library for creating TensorFlow models that consume structured data, where the structure of the computation graph

Official codebase for Pretrained Transformers as Universal Computation Engines.

universal-computation Overview Official codebase for Pretrained Transformers as Universal Computation Engines. Contains demo notebook and scripts to r

The AugNet Python module contains functions for the fast computation of image similarity.
The AugNet Python module contains functions for the fast computation of image similarity.

AugNet AugNet: End-to-End Unsupervised Visual Representation Learning with Image Augmentation arxiv link In our work, we propose AugNet, a new deep le

Owner
Sajjad Aemmi
AI MSc Student at Ferdowsi University of Mashhad - Teacher - Machine Learning Engineer - WebDeveloper - Graphist
Sajjad Aemmi
Face Library is an open source package for accurate and real-time face detection and recognition

Face Library Face Library is an open source package for accurate and real-time face detection and recognition. The package is built over OpenCV and us

null 52 Nov 9, 2022
img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation

img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation Figure 1: We estimate the 6DoF rigid transformation of a 3D face (rendered in si

Vítor Albiero 519 Dec 29, 2022
Active and Sample-Efficient Model Evaluation

Active Testing: Sample-Efficient Model Evaluation Hi, good to see you here! ?? This is code for "Active Testing: Sample-Efficient Model Evaluation". P

Jannik Kossen 19 Oct 30, 2022
Code for HLA-Face: Joint High-Low Adaptation for Low Light Face Detection (CVPR21)

HLA-Face: Joint High-Low Adaptation for Low Light Face Detection The official PyTorch implementation for HLA-Face: Joint High-Low Adaptation for Low L

Wenjing Wang 77 Dec 8, 2022
AI Face Mesh: This is a simple face mesh detection program based on Artificial intelligence.

AI Face Mesh: This is a simple face mesh detection program based on Artificial Intelligence which made with Python. It's able to detect 468 different

Md. Rakibul Islam 1 Jan 13, 2022
A fast, scalable, high performance Gradient Boosting on Decision Trees library, used for ranking, classification, regression and other machine learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.

Website | Documentation | Tutorials | Installation | Release Notes CatBoost is a machine learning method based on gradient boosting over decision tree

CatBoost 6.9k Jan 4, 2023
A fast, scalable, high performance Gradient Boosting on Decision Trees library, used for ranking, classification, regression and other machine learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.

Website | Documentation | Tutorials | Installation | Release Notes CatBoost is a machine learning method based on gradient boosting over decision tree

CatBoost 5.7k Feb 12, 2021
End-to-end face detection, cropping, norm estimation, and landmark detection in a single onnx model

onnx-facial-lmk-detector End-to-end face detection, cropping, norm estimation, and landmark detection in a single onnx model, model.onnx. Demo You can

atksh 42 Dec 30, 2022
Face and Pose detector that emits MQTT events when a face or human body is detected and not detected.

Face Detect MQTT Face or Pose detector that emits MQTT events when a face or human body is detected and not detected. I built this as an alternative t

Jacob Morris 38 Oct 21, 2022
Custom TensorFlow2 implementations of forward and backward computation of soft-DTW algorithm in batch mode.

Batch Soft-DTW(Dynamic Time Warping) in TensorFlow2 including forward and backward computation Custom TensorFlow2 implementations of forward and backw

null 19 Aug 30, 2022