Skip to content

willyfh/farl-face-segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face Segmentation of FaRL Model using Facer

A face segmentation implementation of FarRL model (CVPR 2022) using Facer, a face analysis toolkit for modern research.

The author of FaRL performed pre-training on LAION-FACE, a dataset containing a large amount of face image-text pairs. They then used the pretrained encoder, to extract the image features for training a downstream task, which also includes Face Parsing task. In this work, I utilize the FaRL model which was pretrained on the Face Parsing task, and then map the predicted labels (eyes, nose, mouth, etc.) into two separate labels, i.e., face and background.

Illustration of the FaRL Pretraining Framework

FaRL

Installation

conda create --name {name_env} python==3.8
conda activate {name_env}
pip install git+https://github.com/FacePerceiver/facer.git@main
pip install timm
pip install imutils

Usage

python face_segmentation.py --image_path sample/Shin-Eun-Soo.jpg

To display the list of available arguments:

python face_segmentation.py --help

Output

For left to right: segmented face image, extracted face mask, cropped face Shin-Eun-Soo_stackedsegmentation Shin-Tae-Yong_stackedsegmentation Willy-Fitra-Hendria_stackedsegmentation