A tool for aligning faces.
- Windows
- Ubuntu18.04
- Pytorch
- Skimage
- OpenCV
- Numpy
- Matplotlib
- Pandas
The following features are referenced from
2D and 3D Face alignment library build using pytorch: https://github.com/1adrianb/face-alignment (Landmark detector)
Insightface: https://github.com/deepinsight/insightface (Crop face)
Blur Detection with opencv-python: https://github.com/indyka/blur-detection (Blur detection)
If you want to process images from scratch
python main.py --data_dir [image_dir] --save_dir [save_dir] --img_size 128
--data_dir is the path of unprocessed images.
--save_dir is the path to save output.
--img_size is the cropped images size.
Automatically filtering landmarks is to select the largest face on the image.
If you want to fliter landmark by manual (add --lm_csv [csv_dri], if you have already detected landmark)
python main.py --data_dir [image_dir] --save_dir [save_dir] --img_size 128 --manual
It will show the following window (Use spyder is easier to operate)
then check the terminal, you will see
pick the correct landmark up (r to remove all, s to save a temporary file):
- Input the index you want to preserve.
- If you don't want to preserve any landmark you can input
r
. - If you want to save the file temporary, just input
s
, and when you start it again, it will start with the index you ended.
If you just want to filter image
python main.py --cropped_dir [cropped_dir] --black_threshold 60.0 --blur_threshold 10.0
--cropped_dir is the path of cropped images.
--black_threshold is the ratio of the black area and image.
--blur_threshold is the Laplacian of image, the lower value indicates a blurry image.