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.

Owner
Sajjad Aemmi
AI MSc Student at Ferdowsi University of Mashhad - Teacher - Machine Learning Engineer - WebDeveloper - Graphist
Sajjad Aemmi
Brain tumor detection using CNN (InceptionResNetV2 Model)

Brain-Tumor-Detection Building a detection model using a convolutional neural network in Tensorflow & Keras. Used brain MRI images. InceptionResNetV2

1 Feb 13, 2022
An easy-to-use app to visualise attentions of various VQA models.

Ask Me Anything: A tool for visualising Visual Question Answering (AMA) An easy-to-use app to visualise attentions of various VQA models. Please click

Apoorve 37 Nov 13, 2022
WormMovementSimulation - 3D Simulation of Worm Body Movement with Neurons attached to its body

Generate 3D Locomotion Data This module is intended to create 2D video trajector

1 Aug 09, 2022
Codebase for Inducing Causal Structure for Interpretable Neural Networks

Interchange Intervention Training (IIT) Codebase for Inducing Causal Structure for Interpretable Neural Networks Release Notes 12/01/2021: Code and Pa

Zen 6 Oct 10, 2022
A Python library for generating new text from existing samples.

ReMarkov is a Python library for generating text from existing samples using Markov chains. You can use it to customize all sorts of writing from birt

8 May 17, 2022
[ACL-IJCNLP 2021] Improving Named Entity Recognition by External Context Retrieving and Cooperative Learning

CLNER The code is for our ACL-IJCNLP 2021 paper: Improving Named Entity Recognition by External Context Retrieving and Cooperative Learning CLNER is a

71 Dec 08, 2022
QHack—the quantum machine learning hackathon

Official repo for QHack—the quantum machine learning hackathon

Xanadu 72 Dec 21, 2022
Imbalanced Gradients: A Subtle Cause of Overestimated Adversarial Robustness

Imbalanced Gradients: A Subtle Cause of Overestimated Adversarial Robustness Code for Paper "Imbalanced Gradients: A Subtle Cause of Overestimated Adv

Hanxun Huang 11 Nov 30, 2022
Jittor 64*64 implementation of StyleGAN

StyleGanJittor (Tsinghua university computer graphics course) Overview Jittor 64

Song Shengyu 3 Jan 20, 2022
The official code repo of "HTS-AT: A Hierarchical Token-Semantic Audio Transformer for Sound Classification and Detection"

Hierarchical Token Semantic Audio Transformer Introduction The Code Repository for "HTS-AT: A Hierarchical Token-Semantic Audio Transformer for Sound

Knut(Ke) Chen 134 Jan 01, 2023
PyStan, a Python interface to Stan, a platform for statistical modeling. Documentation: https://pystan.readthedocs.io

PyStan NOTE: This documentation describes a BETA release of PyStan 3. PyStan is a Python interface to Stan, a package for Bayesian inference. Stan® is

Stan 229 Dec 29, 2022
JORLDY an open-source Reinforcement Learning (RL) framework provided by KakaoEnterprise

Repository for Open Source Reinforcement Learning Framework JORLDY

Kakao Enterprise Corp. 330 Dec 30, 2022
Visualizing Yolov5's layers using GradCam

YOLO-V5 GRADCAM I constantly desired to know to which part of an object the object-detection models pay more attention. So I searched for it, but I di

Pooya Mohammadi Kazaj 200 Jan 01, 2023
This is the repository for paper NEEDLE: Towards Non-invertible Backdoor Attack to Deep Learning Models.

This is the repository for paper NEEDLE: Towards Non-invertible Backdoor Attack to Deep Learning Models.

1 Oct 25, 2021
tinykernel - A minimal Python kernel so you can run Python in your Python

tinykernel - A minimal Python kernel so you can run Python in your Python

fast.ai 37 Dec 02, 2022
Trying to understand alias-free-gan.

alias-free-gan-explanation Trying to understand alias-free-gan in my own way. [Chinese Version 中文版本] CC-BY-4.0 License. Tzu-Heng Lin motivation of thi

Tzu-Heng Lin 12 Mar 17, 2022
[ICCV 2021] Deep Hough Voting for Robust Global Registration

Deep Hough Voting for Robust Global Registration, ICCV, 2021 Project Page | Paper | Video Deep Hough Voting for Robust Global Registration Junha Lee1,

Junha Lee 10 Dec 02, 2022
🌾 PASTIS 🌾 Panoptic Agricultural Satellite TIme Series

🌾 PASTIS 🌾 Panoptic Agricultural Satellite TIme Series (optical and radar) The PASTIS Dataset Dataset presentation PASTIS is a benchmark dataset for

86 Jan 04, 2023
Towards End-to-end Video-based Eye Tracking

Towards End-to-end Video-based Eye Tracking The code accompanying our ECCV 2020 publication and dataset, EVE. Authors: Seonwook Park, Emre Aksan, Xuco

Seonwook Park 76 Dec 12, 2022
CPU inference engine that delivers unprecedented performance for sparse models

The DeepSparse Engine is a CPU runtime that delivers unprecedented performance by taking advantage of natural sparsity within neural networks to reduce compute required as well as accelerate memory b

Neural Magic 1.2k Jan 09, 2023