Skip to content

This project aims to add masks to the facial dataset, which is based on FMA-3D and constructs a effective, easy to operate, and efficient pipeline for facial detection, alignment, and mask wearing.

License

Notifications You must be signed in to change notification settings

MetaInsight7/MaskFaceTool

Repository files navigation

MaskFaceTool

This project aims to add masks to the facial dataset, which is based on FMA-3D and constructs a effective, easy to operate, and efficient pipeline for facial detection, alignment, and mask wearing.

Features

  • Effect: Images generated based on FMA-3D are more realistic
  • Efficient: This project provides a dual acceleration solution, using cython and multi process acceleration
  • Easy: You can combine any acceleration scheme according to the server configuration
  • Write the whole process by multi-processing.
  • Write the function of render in face_masker.py by c++.
  • Resolve the bug of noisy generated images

FMA-3D

A method for adding a mask on a non-masked face image. Given a real masked face image (a) and a non-masked face image (d), we synthesize a photo-realistic masked face image with the mask from (a) and the facial area from (d). image

Some Results by FMA-3D

image

Speed Up

To use Cython acceleration, you need to first compile files under the Linux system

  • Step 1: Enter the utils/Python directory
  • Step 2: Execute python setup.py build_ext -i Generate file
  • Step 3: Rename the generated. so file to render.so

Usage

  • normal
python add_mask.py <input-dir-path> -o <output-dir-path> -r <sample-ratio> -s <1: Using Cython to speed up, 0: No speed up>

# Example
python add_mask.py ./webface42m -o ./output -r 0.1 -s 1
  • use multi process acceleration
python add_mask_multiproc.py <input-dir-path> -o <output-dir-path> -r <sample-ratio> -s <1: Using Cython to speed up, 0: No speed up> -c <nums-cpu-cores>

# Example
python add_mask_multiproc.py ./webface42m -o ./output -r 0.1 -s 1 -c 8

Requirements

  • python >= 3.7.1
  • numpy
  • pyyaml
  • pytorch
  • torchvision
  • scikit-image
  • opencv-python
  • Cython(optional)

Reference

yfeng95/PRNet

JDAI-CV/FaceX-Zoo

zengwb-lx/Face_Mask_Add

About

This project aims to add masks to the facial dataset, which is based on FMA-3D and constructs a effective, easy to operate, and efficient pipeline for facial detection, alignment, and mask wearing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published