mirror of
https://github.com/yakhyo/uniface.git
synced 2025-12-30 09:02:25 +00:00
feat: Add usage examples for face detection and face alignment
This commit is contained in:
15
README.md
15
README.md
@@ -12,7 +12,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
**uniface** is a lightweight face detection library designed for high-performance face localization and landmark detection. The library supports ONNX models and provides utilities for bounding box visualization and landmark plotting. To train RetinaFace model, see https://github.com/yakhyo/retinaface-pytorch.
|
||||
**uniface** is a lightweight face detection library designed for high-performance face localization, landmark detection and face alignment. The library supports ONNX models and provides utilities for bounding box visualization and landmark plotting. To train RetinaFace model, see https://github.com/yakhyo/retinaface-pytorch.
|
||||
|
||||
---
|
||||
|
||||
@@ -47,6 +47,19 @@ pip install .
|
||||
|
||||
## Quick Start
|
||||
|
||||
To get started with face detection using **UniFace**, check out the [example notebook](examples/face_detection.ipynb).
|
||||
It demonstrates how to initialize the model, run inference, and visualize the results.
|
||||
|
||||
---
|
||||
|
||||
## Examples
|
||||
|
||||
Explore the following example notebooks to learn how to use **UniFace** effectively:
|
||||
|
||||
- [Face Detection](examples/face_detection.ipynb): Demonstrates how to perform face detection, draw bounding boxes, and landmarks on an image.
|
||||
- [Face Alignment](examples/face_alignment.ipynb): Shows how to align faces using detected landmarks.
|
||||
- [Age and Gender Detection](examples/age_gender.ipynb): Example for detecting age and gender from faces. (underdevelopment)
|
||||
|
||||
### Initialize the Model
|
||||
|
||||
```python
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Example Usage of UniFace Library\n",
|
||||
"This guide demonstrates how to use the **UniFace** library for face detection and visualization in a Jupyter Notebook. Follow the steps below to set up and execute the example.\n",
|
||||
"This guide demonstrates how to use the **UniFace** library for face detection and visualization in this Jupyter Notebook. Follow the steps below to set up and execute the example.\n",
|
||||
"\n",
|
||||
"## 1. Install UniFace\n",
|
||||
"Install the **UniFace** library using `pip`. The `-q` flag suppresses logs for a clean output."
|
||||
|
||||
@@ -4,4 +4,4 @@ logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s - %(levelname)s - %(message)s"
|
||||
)
|
||||
Logger = logging.getLogger("retinaface")
|
||||
Logger = logging.getLogger("uniface")
|
||||
|
||||
@@ -28,8 +28,6 @@ def draw_detections(image, detections, vis_threshold=0.6):
|
||||
landmarks = landmarks[filtered]
|
||||
scores = scores[filtered]
|
||||
|
||||
print(f"#faces: {len(scores)}")
|
||||
|
||||
# Draw bounding boxes, scores, and landmarks
|
||||
for box, score, landmark in zip(boxes, scores, landmarks):
|
||||
cv2.rectangle(image, box[:2], box[2:], (0, 0, 255), 2)
|
||||
|
||||
Reference in New Issue
Block a user