Extracts faces from an image using different backend detectors and save the results in a DataFrame.
Project description
Extracts faces from an image using different backend detectors and save the results in a DataFrame.
pip install gesichtfinder
Tested against Windows 10 / Python 3.10 / Anaconda
This function utilizes the deepface library for face detection, allowing you to choose from various backend detectors
for detecting faces in an image. The detected face regions can be optionally cropped and stored in the DataFrame.
Parameters:
img (str or ndarray): The path to the input image or the image's numpy array representation (RGB format).
cut_out_faces (bool, optional): If True, the detected face regions will be cropped and stored in the DataFrame.
If False, only face coordinates and attributes will be included. Default is True.
backends (tuple, optional): A tuple containing the names of the backend detectors to use for face detection.
Available backends include 'opencv' and 'retinaface'.
Default is ('opencv', 'retinaface').
**kwargs: Additional keyword arguments to be passed to the deepface.extract_faces function.
You can specify options like min_face_size, model, enforce_detection, and more.
Returns:
pandas.DataFrame: A DataFrame containing details of the detected faces and their attributes, including:
- 'x': X-coordinate of the top-left corner of the detected face bounding box.
- 'y': Y-coordinate of the top-left corner of the detected face bounding box.
- 'w': Width of the detected face bounding box.
- 'h': Height of the detected face bounding box.
- 'end_x': X-coordinate of the bottom-right corner of the detected face bounding box.
- 'end_y': Y-coordinate of the bottom-right corner of the detected face bounding box.
- 'confidence': Confidence score of the face detection.
- 'backend': The backend detector used for the detection.
- 'faces' (optional): Cropped face regions if 'cut_out_faces' is True.
Example:
# Import the required libraries
# Example usage:
from gesichtfinder import get_faces
df = get_faces(img=r"c:\asy.jpg", cut_out_faces=True, backends=('opencv', 'retinaface'))
print(df)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gesichtfinder-0.10.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file gesichtfinder-0.10.tar.gz
.
File metadata
- Download URL: gesichtfinder-0.10.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 483a450edb7d50863e0b56b456ec1659ea4dd49a7c2922a77e3b901617f38cd5 |
|
MD5 | 9726d7252a4f5b777fc1e8586cf631b5 |
|
BLAKE2b-256 | a40490ac108fb090e539fcba33e00c565e38b517bfef0ad631bb2d2d83905014 |
File details
Details for the file gesichtfinder-0.10-py3-none-any.whl
.
File metadata
- Download URL: gesichtfinder-0.10-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c202e92d22a1a8f0cba7f67f48720217e9c30d58b187f00c3617d4b2a15185d |
|
MD5 | 6eec4f66d364d41bf57a314a1ad8ee01 |
|
BLAKE2b-256 | d89ac36dfba1a96325e2aef01e27c79cdde97731aabfdeaeaeb5827f071de012 |