Skip to content

yakhyo/face-segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face Segmentation

Python License Downloads

Tip

The models and functionality in this repository are integrated into UniFace — an all-in-one face analysis library. PyPI Version GitHub Stars License

Face segmentation using XSeg model from DeepFaceLab with UniFace for face detection and alignment. Automatically detects faces and generates pixel-accurate segmentation masks.

Face Segmentation Result

Installation

pip install -r requirements.txt

Download Weights

Download the pre-trained XSeg ONNX model:

Model Size Download
XSeg 70 MB xseg.onnx

Place the downloaded model in the weights/ directory.

Usage

python main.py --model weights/xseg.onnx --image assets/einstien.png

Options:

Argument Default Description
--model required Path to XSeg ONNX model
--image assets/einstien.png Input image path
--output None Output image path
--blur 0 Gaussian blur sigma for mask smoothing
--align-size 256 Face alignment size

Outputs

The script generates:

  • *_xseg_result.png - Image with mask overlay
  • *_xseg_mask.png - Binary segmentation mask
  • *_xseg_comparison.png - Side-by-side comparison
  • *_aligned_crop.png - Aligned face crop

References

License

GNU General Public License v3.0

About

Face Segmentation using XSeg model from DeepFaceLab | ONNX Runtime Inference

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages