# Wrapper over YoloV5Face
![](https://habrastorage.org/webt/gy/-1/xd/gy-1xdtfz3_i7xxt-nqzl4mfhuw.jpeg)
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:
```bash
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:
```bash
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](LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/ternaus/yolov5faceInference",
"name": "yolo5face",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Vladimir Iglovikov",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/3e/fe/26e3a63f0e7ad4914b5ac1692374f899427a063c133a1d31d7f9c194f977/yolo5face-0.0.10.tar.gz",
"platform": null,
"description": "# Wrapper over YoloV5Face\n\n![](https://habrastorage.org/webt/gy/-1/xd/gy-1xdtfz3_i7xxt-nqzl4mfhuw.jpeg)\n\nA 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.\n\n## Installation\n\nInstall the YoloV5Face wrapper using pip to easily incorporate it into your projects:\n\n```bash\npip install -U yolo5face\n```\n\n## Face Detection: Standard and Enhanced\n\nThe 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.\n\n### Getting Started\n\nTo detect faces in an image:\n\n```bash\nfrom yolo5face.get_model import get_model\nimport cv2\n\n# Initialize the model\nmodel = get_model(\"yolov5n\", device=-1, min_face=24)\n\n# Load your image\nimage = cv2.imread(<IMAGE_PATH>)\nimage = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n\n# Standard Detection\nboxes, key_points, scores = model(image, target_size=512)\n\n# Enhanced Detection (aggregating over multiple target sizes)\nenhanced_boxes, enhanced_key_points, enhanced_scores = model(image, target_size=[320, 640, 1280])\n```\n\nParameters:\n\n* **device**: Set the processing device (cpu, cuda, mps, or CUDA device number).\n* **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.\n* **min_face**: Minimum size of faces to detect in pixels. Smaller faces will be ignored.\n\nThis approach, especially the enhanced detection, uses multiple scales for improved accuracy and is followed by Non-Maximum Suppression to refine the results.\n\n## License\n\nThis YoloV5Face wrapper is released under the [MIT License](LICENSE).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Wrapper over Yolo5Face for a more convenient inference.",
"version": "0.0.10",
"project_urls": {
"Homepage": "https://github.com/ternaus/yolov5faceInference"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "026a008fba082967442eba466a240f23d3252633d5ef32a04b916fc97ffd9ad9",
"md5": "5f05e8ede093892cd565f2d20f23db49",
"sha256": "bcf7146e404a8d22437dd6cffbe72ce3048b027d986c93b7c8109227109bef79"
},
"downloads": -1,
"filename": "yolo5face-0.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5f05e8ede093892cd565f2d20f23db49",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 18770,
"upload_time": "2023-11-26T01:02:23",
"upload_time_iso_8601": "2023-11-26T01:02:23.778451Z",
"url": "https://files.pythonhosted.org/packages/02/6a/008fba082967442eba466a240f23d3252633d5ef32a04b916fc97ffd9ad9/yolo5face-0.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3efe26e3a63f0e7ad4914b5ac1692374f899427a063c133a1d31d7f9c194f977",
"md5": "26ec4558708d6cf904012d144fbb9a37",
"sha256": "0c830efe6196c6e0dd49e8393e28c2284e0bd49b517cc23d6843b2674f1a4d08"
},
"downloads": -1,
"filename": "yolo5face-0.0.10.tar.gz",
"has_sig": false,
"md5_digest": "26ec4558708d6cf904012d144fbb9a37",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16388,
"upload_time": "2023-11-26T01:02:25",
"upload_time_iso_8601": "2023-11-26T01:02:25.342513Z",
"url": "https://files.pythonhosted.org/packages/3e/fe/26e3a63f0e7ad4914b5ac1692374f899427a063c133a1d31d7f9c194f977/yolo5face-0.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-26 01:02:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ternaus",
"github_project": "yolov5faceInference",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "yolo5face"
}