Skip to main content

Wrapper over Yolo5Face for a more convenient inference.

Project description

Wrapper over YoloV5Face

A user-friendly Python wrapper for the YoloV5Face model, designed to simplify face detection in images. This wrapper offers straightforward functionalities for quick integration into Python projects, along with customization options for handling various face detection scenarios.

Installation

Install the YoloV5Face wrapper using pip to easily incorporate it into your projects:

pip install -U yolo5face

Face Detection: Standard and Enhanced

The YoloV5Face wrapper supports both standard and enhanced face detection. The standard detection is suitable for most use cases, while the enhanced detection, which aggregates results over multiple target sizes, is ideal for images with faces of varying sizes.

Getting Started

To detect faces in an image:

from yolo5face.get_model import get_model
import cv2

# Initialize the model
model = get_model("yolov5n", device=-1, min_face=24)

# Load your image
image = cv2.imread(<IMAGE_PATH>)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

# Standard Detection
boxes, key_points, scores = model(image, target_size=512)

# Enhanced Detection (aggregating over multiple target sizes)
enhanced_boxes, enhanced_key_points, enhanced_scores = model(image, target_size=[320, 640, 1280])

Parameters:

  • device: Set the processing device (cpu, cuda, mps, or CUDA device number).
  • target_size: For standard detection, it's the minimum size of the target image. For enhanced detection, provide a list of sizes for better accuracy.
  • min_face: Minimum size of faces to detect in pixels. Smaller faces will be ignored.

This approach, especially the enhanced detection, uses multiple scales for improved accuracy and is followed by Non-Maximum Suppression to refine the results.

License

This YoloV5Face wrapper is released under the MIT License.

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

yolo5face-0.0.9.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

yolo5face-0.0.9-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file yolo5face-0.0.9.tar.gz.

File metadata

  • Download URL: yolo5face-0.0.9.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for yolo5face-0.0.9.tar.gz
Algorithm Hash digest
SHA256 ef3d27f9bb1ccfd77197af53979dfc9ec29ddc837f91a50bec4c23721343a09c
MD5 a71aa1daeab66c544c01a8df1c96af53
BLAKE2b-256 8be7ed7a69a81a790cf25afbbeb4936ebb51bfd6612a5ab00d5450684e8a9248

See more details on using hashes here.

File details

Details for the file yolo5face-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: yolo5face-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for yolo5face-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3de08aaa5866fadcaddb367bc0f69fae6189be084b0ad0775d71013680ca994c
MD5 07e238a2829e8da5ee734d27725196a8
BLAKE2b-256 e19892af32d411512b64771068bd9bf9f77c008ff01aadb5a507f838bed6bdf4

See more details on using hashes here.

Supported by

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