logo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions

89 lines
1.8 KiB

# RetinaFace Face Detection
3 years ago
*author: David Wang*
<br />
## Description
This operator detects faces in the images by using [RetinaFace](https://arxiv.org/abs/1905.00641) Detector. It will return the bounding box positions and the confidence scores of detected faces. This repo is an adaptaion from [biubug6/Pytorch_Retinaface](https://github.com/biubug6/Pytorch_Retinaface).
<br />
## Code Example
Load an image from path './turing.png' and use the pretrained RetinaFace model to generate face bounding boxes and confidence scores.
*Write the pipeline in simplified style:*
```python
import towhee
towhee.glob('turing.png') \
.image_decode() \
.face_detection.retinaface() \
.show()
```
<img src="https://towhee.io/face-detection/retinaface/raw/branch/main/result1.png" alt="result1" style="height:20px;"/>
*Write a same pipeline with explicit inputs/outputs name specifications:*
```python
import towhee
towhee.glob['path']('turing.png') \
.image_decode['path', 'img']() \
.face_detection.retinaface['img', ('bbox','score')]() \
.image_crop[('img', 'bbox'), 'crop']()\
.select('img', 'crop', 'bbox', 'score').show()
```
<img src="https://towhee.io/face-detection/retinaface/raw/branch/main/result2.jpg" alt="result2" style="height:60px;"/>
<br />
## Factory Constructor
Create the operator via the following factory method.
***face_detection.retinaface()***
<br />
## Interface
A face detection operator takes an image as input. It generates the bounding box positions and confidence scores back to ndarray.
**Parameters:**
***img:*** *towhee.types.Image (a sub-class of numpy.ndarray)*
​ the image to detect faces.
​ supported types: numpy.ndarray
**Returns:**
*List[(int, int, int, int)]*
​ The detected face bounding boxes.
*List[float]*
​ The detected face bounding boxes confident scores.