Code for BMVC2021 "MOS: A Low Latency and Lightweight Framework for Face Detection, Landmark Localization, and Head Pose Estimation"

Overview

MOS-Multi-Task-Face-Detect

Introduction

This repo is the official implementation of "MOS: A Low Latency and Lightweight Framework for Face Detection, Landmark Localization, and Head Pose Estimation". The paper has been accepted at BMVC2021.

This repo is an implementation of PyTorch. MOS is a low latency and lightweight architecture for face detection, facial landmark localization and head pose estimation.It aims to bridge the gap between research and industrial communities. For more details, please refer to our report on Arxiv.

Updates

  • 【2021/10/31】 We have released the training data (widerface with pose label). The pytorch inference code of MOS-S and MOS-M has been released!
  • 【2021/10/22】 We have released our paper on Arxiv.
  • 【2021/10/15】 "MOS: A Low Latency and Lightweight Framework for Face Detection, Landmark Localization, and Head Pose Estimation" has been accepted at BMVC2021.

Comming soon

  • Tensorrt inference code.
  • Openvino inference code.
  • Ncnn inference code.
  • The fastest version: MOS-tiny.

Benchmark

Light Models.

WiderFace Val Performance is in multi scale and Pose evaluation is using AFLW2000 in 300X300 as image input.

Model backbone easy medium hard pitch yaw roll
MOS-M mobilenetV2 94.08 93.21 88.06 6.67 4.43 5.83
MOS-S shufflenetV2 93.28 92.12 86.97 6.80 4.28 5.99

generate widerface validation results

  1. Generate txt file You need download the validation and test dataset of WiderFace from Here
python test_widerface.py --network cfg_mos_m --trained_model ./test_weights/MOS-M.pth
  1. Evaluate txt results. Demo come from Here
cd ./widerface_evaluate
python setup.py build_ext --inplace
python evaluation.py

Training data

  1. Download annotations (face bounding boxes & five facial landmarks & pose angle(pitch,yaw,roll)) from baidu cloud , the code is 0925. We also provide the GOOGLE DRIVE
  2. Organise the dataset directory as follows:
  ./data/widerface/
    train/
      images/
      label.txt

The annotation file is like:

# 0--Parade/0_Parade_marchingband_1_849.jpg
449 330 122 149 488.906 373.643 0.0 542.089 376.442 0.0 515.031 412.83 0.0 485.174 425.893 0.0 538.357 431.491 0.0 0.82 -6 -6 1

face_x face_y face_width face_height landmark1.x landmark1.y 0.0 landmark2.x landmark2.y 0.0 landmark3.x landmark3.y 0.0 landmark4.x landmark4.y 0.0
landmark5.x landmark5.y 0.0 confidence pitch yaw roll

Quick Start

Installation

Step1. Install MOS.

git clone https://github.com/lyp-deeplearning/MOS-Multi-Task-Face-Detect.git
cd MOS-Multi-Task-Face-Detect
conda create -n MOS python=3.8.5
conda activate MOS
pip install -r requirements.txt
cd models/DCNv2/
python setup.py build develop

Step2. Run Pytorch inference demo.

## run the MOS-M model 
python detect_picture.py --network cfg_mos_m --trained_model ./test_weights/MOS-M.pth
## run the MOS-S model
python detect_picture.py --network cfg_mos_s --trained_model ./test_weights/MOS-S.pth

Step3. Run video inference demo.

## run the MOS-M model 
python detect_video.py --network cfg_mos_m --trained_model ./test_weights/MOS-M.pth

Cite MOS

If you use MOS in your research, please cite our work by using the following BibTeX entry:

@article{liu2021mos,
  title={MOS: A Low Latency and Lightweight Framework for Face Detection, Landmark Localization, and Head Pose Estimation},
  author={Liu, Yepeng and Gu, Zaiwang and Gao, Shenghua and Wang, Dong and Zeng, Yusheng and Cheng, Jun},
  journal={arXiv preprint arXiv:2110.10953},
  year={2021}
}
Comments
  • how to solve this question

    how to solve this question

    Thanks for the awesome work!The following problems occur when configuring the environment according to the tutorial and and how to solve this problem? running build running build_ext Traceback (most recent call last): File "setup.py", line 55, in setup( File "/home/os/anaconda3/envs/MOS/lib/python3.8/site-packages/setuptools/init.py", line 159, in setup return distutils.core.setup(**attrs) File "/home/os/anaconda3/envs/MOS/lib/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/home/os/anaconda3/envs/MOS/lib/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/home/os/anaconda3/envs/MOS/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/os/anaconda3/envs/MOS/lib/python3.8/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/home/os/anaconda3/envs/MOS/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/os/anaconda3/envs/MOS/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/os/anaconda3/envs/MOS/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run _build_ext.run(self) File "/home/os/anaconda3/envs/MOS/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/home/os/anaconda3/envs/MOS/lib/python3.8/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/home/os/anaconda3/envs/MOS/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 348, in build_extensions self._check_abi() File "/home/os/anaconda3/envs/MOS/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 679, in _check_abi check_compiler_abi_compatibility(compiler) File "/home/os/anaconda3/envs/MOS/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 252, in check_compiler_abi_compatibility if not check_compiler_ok_for_platform(compiler): File "/home/os/anaconda3/envs/MOS/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 212, in check_compiler_ok_for_platform which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT) File "/home/os/anaconda3/envs/MOS/lib/python3.8/subprocess.py", line 411, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/home/os/anaconda3/envs/MOS/lib/python3.8/subprocess.py", line 512, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['which', 'aarch64-linux-gnu-g++']' returned non-zero exit status 1.

    opened by ChaocunChen 4
  • Question about the uncertainty output

    Question about the uncertainty output

    Thanks for your work.

    As you introduced in the paper, you used uncertainty multi-task loss to automatically adjust the weights for different output.

    However, I checked through the paper and your released code, and I cannot find any output about uncertainty. Was it because I was too careless to find out, or did you not write?

    opened by FunkyKoki 3
  • Google drive link for widerface with pose?

    Google drive link for widerface with pose?

    Thanks for the awesome work! Any chance you could share a Google Drive link for your widerface with pose dataset? It can be very difficult to access baidu for those of us outside China.

    opened by yhenon 3
  • Compiling error when running command 'python setup.py build develop'

    Compiling error when running command 'python setup.py build develop'

    Thanks for your awesome work! image I got above error when compiling DCNv2 using setup.py. My device is my personal PC (win11,AMD64,x64-based PC). My torch version is 1.11.0+cu113. i don't know whether i should update DCNv2 to corresponding version, and such problem can be solve? Could you please give any help?

    opened by 20XYSong 0
  • Question about 300W-LP training

    Question about 300W-LP training

    Thanks again for your work.

    Can you please provide the training details of the the MOS-S-300wlp model? How did you define the supervision, and what are your training settings?

    opened by FunkyKoki 1
  • Question about the performance

    Question about the performance

    Thanks again for your work.

    Since you use flip and multi-scale strategy in testing, I wonder how your model performs when these test tricks are not applied.

    I ask this question because in real-time application sceneries, these tricks are not useful.

    opened by FunkyKoki 0
  • The histogram between Figure 3(b) and label.txt are difference

    The histogram between Figure 3(b) and label.txt are difference

    Hi expert, I try to verify histogram with your "label.txt" on Figure 3(b) but I found large difference between Figure 3(b) and label.txt. The following statistics from "label.txt":

    data size: 12852 pitch_angle 0 ~ 30, 30 ~ 60, 60 ~ 90: [156625, 550, 9] yaw_angle 0 ~ 30, 30 ~ 60, 60 ~ 90: [145847, 8444, 2893] roll_angle 0 ~ 30, 30 ~ 60, 60 ~ 90: [156987, 192, 5] total image size: 12852 total_face_size: 157184

    There only the size of face are 59434 on Figure 3(b), but 157184 on "label.txt" May you tell me how to calculate your histogram? Thanks

    opened by BossunWang 0
The pytorch implementation of SOKD (BMVC2021).

Semi-Online Knowledge Distillation Implementations of SOKD. Requirements This repo was tested with Python 3.8, PyTorch 1.5.1, torchvision 0.6.1, CUDA

null 4 Dec 19, 2021
Official PyTorch Implementation of Mask-aware IoU and maYOLACT Detector [BMVC2021]

The official implementation of Mask-aware IoU and maYOLACT detector. Our implementation is based on mmdetection. Mask-aware IoU for Anchor Assignment

Kemal Oksuz 11 Oct 21, 2021
[BMVC2021] The official implementation of "DomainMix: Learning Generalizable Person Re-Identification Without Human Annotations"

DomainMix [BMVC2021] The official implementation of "DomainMix: Learning Generalizable Person Re-Identification Without Human Annotations" [paper] [de

Wenhao Wang 17 Dec 20, 2022
This repo is for Self-Supervised Monocular Depth Estimation with Internal Feature Fusion(arXiv), BMVC2021

DIFFNet This repo is for Self-Supervised Monocular Depth Estimation with Internal Feature Fusion(arXiv), BMVC2021 A new backbone for self-supervised d

Hang 3 Oct 22, 2021
This is the official source code for SLATE. We provide the code for the model, the training code, and a dataset loader for the 3D Shapes dataset. This code is implemented in Pytorch.

SLATE This is the official source code for SLATE. We provide the code for the model, the training code and a dataset loader for the 3D Shapes dataset.

Gautam Singh 66 Dec 26, 2022
TensorFlow code for the neural network presented in the paper: "Structural Language Models of Code" (ICML'2020)

SLM: Structural Language Models of Code This is an official implementation of the model described in: "Structural Language Models of Code" [PDF] To ap

null 73 Nov 6, 2022
Inference code for "StylePeople: A Generative Model of Fullbody Human Avatars" paper. This code is for the part of the paper describing video-based avatars.

NeuralTextures This is repository with inference code for paper "StylePeople: A Generative Model of Fullbody Human Avatars" (CVPR21). This code is for

Visual Understanding Lab @ Samsung AI Center Moscow 18 Oct 6, 2022
A code generator from ONNX to PyTorch code

onnx-pytorch Generating pytorch code from ONNX. Currently support onnx==1.9.0 and torch==1.8.1. Installation From PyPI pip install onnx-pytorch From

Wenhao Hu 94 Jan 6, 2023
This is the code for our KILT leaderboard submission to the T-REx and zsRE tasks. It includes code for training a DPR model then continuing training with RAG.

KGI (Knowledge Graph Induction) for slot filling This is the code for our KILT leaderboard submission to the T-REx and zsRE tasks. It includes code fo

International Business Machines 72 Jan 6, 2023
Convert Python 3 code to CUDA code.

Py2CUDA Convert python code to CUDA. Usage To convert a python file say named py_file.py to CUDA, run python generate_cuda.py --file py_file.py --arch

Yuval Rosen 3 Jul 14, 2021
Empirical Study of Transformers for Source Code & A Simple Approach for Handling Out-of-Vocabulary Identifiers in Deep Learning for Source Code

Transformers for variable misuse, function naming and code completion tasks The official PyTorch implementation of: Empirical Study of Transformers fo

Bayesian Methods Research Group 56 Nov 15, 2022
Reference implementation of code generation projects from Facebook AI Research. General toolkit to apply machine learning to code, from dataset creation to model training and evaluation. Comes with pretrained models.

This repository is a toolkit to do machine learning for programming languages. It implements tokenization, dataset preprocessing, model training and m

Facebook Research 408 Jan 1, 2023
Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

CoProtector Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

Zhensu Sun 1 Oct 26, 2021
Low-code/No-code approach for deep learning inference on devices

EzEdgeAI A concept project that uses a low-code/no-code approach to implement deep learning inference on devices. It provides a componentized framewor

On-Device AI Co., Ltd. 7 Apr 5, 2022
Code for all the Advent of Code'21 challenges mostly written in python

Advent of Code 21 Code for all the Advent of Code'21 challenges mostly written in python. They are not necessarily the best or fastest solutions but j

null 4 May 26, 2022
Code to use Augmented Shapiro Wilks Stopping, as well as code for the paper "Statistically Signifigant Stopping of Neural Network Training"

This codebase is being actively maintained, please create and issue if you have issues using it Basics All data files are included under losses and ea

J K Terry 32 Nov 9, 2021
Opinionated code formatter, just like Python's black code formatter but for Beancount

beancount-black Opinionated code formatter, just like Python's black code formatter but for Beancount Try it out online here Features MIT licensed - b

Launch Platform 16 Oct 11, 2022
a delightful machine learning tool that allows you to train, test and use models without writing code

igel A delightful machine learning tool that allows you to train/fit, test and use models without writing code Note I'm also working on a GUI desktop

Nidhal Baccouri 3k Jan 5, 2023
Pytorch Lightning code guideline for conferences

Deep learning project seed Use this seed to start new deep learning / ML projects. Built in setup.py Built in requirements Examples with MNIST Badges

Pytorch Lightning 1k Jan 2, 2023