A Python port of Google MediaPipe Face Detection modules
Project description
Face Detection For Python
This package implements parts of Google®'s MediaPipe models in pure Python (with a little help from Numpy and PIL) without Protobuf
graphs and with minimal dependencies (just TF Lite and Pillow).
Models and Examples
The package provides the following models:
- Face Detection
- Face Landmark Detection
- Iris Landmark Detection
- Iris recoloring example
Motivation
The package doesn't use the graph approach implemented by MediaPipe and is therefore not as flexible. It is, however, somewhat easier to use and understand and more accessible to recreational programming and experimenting with the pretrained ML models than the rather complex MediaPipe framework.
Here's how face detection works and an image like shown above can be produced:
from fdlite import FaceDetection
from fdlite.render import Colors, detections_to_render_data, render_to_image
from PIL import Image
image = Image.open('group.jpg')
detect_faces = FaceDetection()
faces = detect_faces(image)
if len(faces) == 0:
print('no faces detected :(')
else:
render_data = detections_to_render_data(faces, bounds_color=Colors.GREEN)
render_to_image(render_data, image).show()
While this example isn't that much simpler than the MediaPipe equivalent, some models (e.g. iris detection) aren't available in the Python API.
Installation
The package can be installed by navigating to the folder containing setup.py
and running
pip install .
from a shell or command prompt.
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
Built Distribution
Hashes for face-detection-tflite-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6c29228a39eb1e1bb38655264853671d9823a0c1193a7cd37b4336c8667548f |
|
MD5 | 8b10c2813ae89feb3da6d6a526fd3c48 |
|
BLAKE2b-256 | 9fc0e95f274702b30ba5da885131dd6259eed67c889a6617b7b308ea042c76e9 |
Hashes for face_detection_tflite-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76413723c94e62bc5f0a74fdad17382db27d9c4f4bda7df07848bf7cf4769e06 |
|
MD5 | 6815f33efe42f021cfdd8fa04855bb43 |
|
BLAKE2b-256 | e158e9be0c4b80458a92ae51620fc5880e6dcc668664c3e70d8186a4ddce96b3 |