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
Synthesize photos from PhotoDNA using machine learning 🌱

Ribosome Synthesize photos from PhotoDNA. See the blog post for more information. Installation Dependencies You can install Python dependencies using

Anish Athalye 112 Nov 23, 2022
ScaleNet: A Shallow Architecture for Scale Estimation

ScaleNet: A Shallow Architecture for Scale Estimation Repository for the code of ScaleNet paper: "ScaleNet: A Shallow Architecture for Scale Estimatio

Axel Barroso 34 Nov 09, 2022
Code for the ECIR'22 paper "Evaluating the Robustness of Retrieval Pipelines with Query Variation Generators"

Query Variation Generators This repository contains the code and annotation data for the ECIR'22 paper "Evaluating the Robustness of Retrieval Pipelin

Gustavo Penha 12 Nov 20, 2022
Tensorflow implementation of Human-Level Control through Deep Reinforcement Learning

Human-Level Control through Deep Reinforcement Learning Tensorflow implementation of Human-Level Control through Deep Reinforcement Learning. This imp

Devsisters Corp. 2.4k Dec 26, 2022
[AAAI 2022] Negative Sample Matters: A Renaissance of Metric Learning for Temporal Grounding

[AAAI 2022] Negative Sample Matters: A Renaissance of Metric Learning for Temporal Grounding Official Pytorch implementation of Negative Sample Matter

Multimedia Computing Group, Nanjing University 69 Dec 26, 2022
SimDeblur is a simple framework for image and video deblurring, implemented by PyTorch

SimDeblur (Simple Deblurring) is an open source framework for image and video deblurring toolbox based on PyTorch, which contains most deep-learning based state-of-the-art deblurring algorithms. It i

220 Jan 07, 2023
FID calculation with proper image resizing and quantization steps

clean-fid: Fixing Inconsistencies in FID Project | Paper The FID calculation involves many steps that can produce inconsistencies in the final metric.

Gaurav Parmar 606 Jan 06, 2023
Unofficial PyTorch implementation of Attention Free Transformer (AFT) layers by Apple Inc.

aft-pytorch Unofficial PyTorch implementation of Attention Free Transformer's layers by Zhai, et al. [abs, pdf] from Apple Inc. Installation You can i

Rishabh Anand 184 Dec 12, 2022
Reinforcement-learning - Repository of the class assignment questions for the course on reinforcement learning

DSE 314/614: Reinforcement Learning This repository containing reinforcement lea

Manav Mishra 4 Apr 15, 2022
BrainGNN - A deep learning model for data-driven discovery of functional connectivity

A deep learning model for data-driven discovery of functional connectivity https://doi.org/10.3390/a14030075 Usman Mahmood, Zengin Fu, Vince D. Calhou

Usman Mahmood 3 Aug 28, 2022
Cupytorch - A small framework mimics PyTorch using CuPy or NumPy

CuPyTorch CuPyTorch是一个小型PyTorch,名字来源于: 不同于已有的几个使用NumPy实现PyTorch的开源项目,本项目通过CuPy支持

Xingkai Yu 23 Aug 17, 2022
PyTorch implementation of 'Gen-LaneNet: a generalized and scalable approach for 3D lane detection'

(pytorch) Gen-LaneNet: a generalized and scalable approach for 3D lane detection Introduction This is a pytorch implementation of Gen-LaneNet, which p

Yuliang Guo 233 Jan 06, 2023
Keras like implementation of Deep Learning architectures from scratch using numpy.

Mini-Keras Keras like implementation of Deep Learning architectures from scratch using numpy. How to contribute? The project contains implementations

MANU S PILLAI 5 Oct 10, 2021
Data Augmentation Using Keras and Python

Data-Augmentation-Using-Keras-and-Python Data augmentation is the process of increasing the number of training dataset. Keras library offers a simple

Happy N. Monday 3 Feb 15, 2022
GAN-based Matrix Factorization for Recommender Systems

GAN-based Matrix Factorization for Recommender Systems This repository contains the datasets' splits, the source code of the experiments and their res

Ervin Dervishaj 9 Nov 06, 2022
[NeurIPS 2021] Garment4D: Garment Reconstruction from Point Cloud Sequences

Garment4D [PDF] | [OpenReview] | [Project Page] Overview This is the codebase for our NeurIPS 2021 paper Garment4D: Garment Reconstruction from Point

Fangzhou Hong 112 Dec 23, 2022
A custom-designed Spider Robot trained to walk using Deep RL in a PyBullet Simulation

SpiderBot_DeepRL Title: Implementation of Single and Multi-Agent Deep Reinforcement Learning Algorithms for a Walking Spider Robot Authors(s): Arijit

Arijit Dasgupta 9 Jul 28, 2022
Make your own game in a font!

Project structure. Included is a suite of tools to create font games. Tutorial: For a quick tutorial about how to make your own game go here For devel

Michael Mulet 125 Dec 04, 2022
Workshop Materials Delivered on 28/02/2022

intro-to-cnn-p1 Repo for hosting workshop materials delivered on 28/02/2022 Questions you will answer in this workshop Learning Objectives What are co

Beginners Machine Learning 5 Feb 28, 2022
Train SN-GAN with AdaBelief

SNGAN-AdaBelief Train a state-of-the-art spectral normalization GAN with AdaBelief https://github.com/juntang-zhuang/Adabelief-Optimizer Acknowledgeme

Juntang Zhuang 10 Jun 11, 2022