Skip to main content

A Python library for face parsing and feature extraction

Project description

FaceParser

A Python library for face parsing and feature extraction using BiSeNet. This library provides tools for facial feature detection, segmentation, and analysis.

Features

  • Facial feature parsing and segmentation
  • Feature coordinate extraction
  • Facial metrics calculation
  • CLI tool for easy model management and image processing
  • Visualization tools for parsed features

Installation

pip install faceparser

After installation, you need to download the model weights:

faceparser install

Usage

Command Line Interface

  1. Install model:
faceparser install
  1. Check model installation:
faceparser check
  1. Parse an image:
faceparser parse path/to/image.jpg -o output_directory --save-masks

Python API

from faceparser import get_coordinates

# Parse an image
coordinates = get_coordinates("path/to/image.jpg")

# Get feature embeddings
embeddings = coordinates.get_all_embeddings()

# Get face metrics
metrics = coordinates.get_relative_metrics()
symmetry = coordinates.get_symmetry_score()

# Access individual feature metrics
for feature, area in metrics['feature_areas'].items():
    print(f"{feature} area: {area:.3f}")

Model Details

The face parsing model is based on BiSeNet architecture and trained on the CelebAMask-HQ dataset. It can detect and segment the following facial features:

  • Skin
  • Nose
  • Eyes (left and right)
  • Eyebrows (left and right)
  • Ears (left and right)
  • Mouth
  • Upper and lower lips
  • Hair
  • Hat
  • Eyeglasses
  • Earrings
  • Necklace
  • Neck
  • Clothes

Feature Metrics

The library provides various metrics for facial analysis:

  • Feature embeddings (normalized position, size, area, aspect ratio)
  • Face symmetry score
  • Feature areas (normalized)
  • Normalized distances between features
  • Relative positions
  • Feature aspect ratios

License

This project is licensed under the MIT License - see the LICENSE file for details.#\x00 \x00f\x00a\x00c\x00e\x00p\x00a\x00r\x00s\x00e\x00r\x00 \x00 \x00

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

face_feature_parser-1.0.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

face_feature_parser-1.0.1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file face_feature_parser-1.0.1.tar.gz.

File metadata

  • Download URL: face_feature_parser-1.0.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for face_feature_parser-1.0.1.tar.gz
Algorithm Hash digest
SHA256 70bd65a093aad21395d897f75f5bfc76a00910fb278ddf0d0ac6c7bb8c60107d
MD5 34f97fc6909fbf325a9075f0bdfde507
BLAKE2b-256 83c692a9ced0f51f734a59c2bec2b48d9e1fcbf93bd6160a553ad1d9c599ee5c

See more details on using hashes here.

File details

Details for the file face_feature_parser-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for face_feature_parser-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e22e9268a07d14a56c5fca0f0b3b49409f9c1fae5c91e8c48fd50f3d668b42c8
MD5 c990af06cff161cef3bb2c4658a725c8
BLAKE2b-256 0fd3ab702322671d5641894da801abb6a288d7c6850e7781bf7f3a1d9b17b3fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page