Skip to content

RayOct18/face_aligment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face Alignment

A tool for aligning faces.

Environment

  • Windows
  • Ubuntu18.04

Prerequisites

  • Pytorch
  • Skimage
  • OpenCV
  • Numpy
  • Matplotlib
  • Pandas

Reference

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)

How to use

One button

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.

crop_sample

Manually filter landmark

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)

filter_lm

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.

Image filter

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.

filter_img

About

Facial image processing tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages