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

3.6 KiB

RetinaFace Face Detection

author: David Wang


Description

This operator detects faces in the images by using RetinaFace Detector. It will return the bounding box positions and the confidence scores of detected faces. This repository is an adaptation from biubug6/Pytorch_Retinaface.


Code Example

Load an image from path './turing.png' and use the pre-trained RetinaFace model to generate face bounding boxes and confidence scores.

Write a pipeline with explicit inputs/outputs name specifications:

from towhee import pipe, ops, DataCollection

p = (
    pipe.input('path')
        .map('path', 'img', ops.image_decode())
        .map('img', ('bbox','score'), ops.face_detection.retinaface())
        .map(('img', 'bbox'),'crop', ops.image_crop())
        .output('img', 'crop', 'bbox', 'score')
)

DataCollection(p('turing.png')).show()
result2


Factory Constructor

Create the operator via the following factory method:

face_detection.retinaface()


Interface

A face detection operator takes an image as input. It generates the bounding box positions and confidence scores in ndarray.

Parameters:

img: towhee.types.Image (a sub-class of numpy.ndarray)

​ the image to detect faces from.

​ supported types: numpy.ndarray

Returns:

List[(int, int, int, int)]

​ The position of the bounding boxes for the faces detected.

List[float]

​ The confidence scores for the face detected in the bounding boxes.

More Resources

3.6 KiB

RetinaFace Face Detection

author: David Wang


Description

This operator detects faces in the images by using RetinaFace Detector. It will return the bounding box positions and the confidence scores of detected faces. This repository is an adaptation from biubug6/Pytorch_Retinaface.


Code Example

Load an image from path './turing.png' and use the pre-trained RetinaFace model to generate face bounding boxes and confidence scores.

Write a pipeline with explicit inputs/outputs name specifications:

from towhee import pipe, ops, DataCollection

p = (
    pipe.input('path')
        .map('path', 'img', ops.image_decode())
        .map('img', ('bbox','score'), ops.face_detection.retinaface())
        .map(('img', 'bbox'),'crop', ops.image_crop())
        .output('img', 'crop', 'bbox', 'score')
)

DataCollection(p('turing.png')).show()
result2


Factory Constructor

Create the operator via the following factory method:

face_detection.retinaface()


Interface

A face detection operator takes an image as input. It generates the bounding box positions and confidence scores in ndarray.

Parameters:

img: towhee.types.Image (a sub-class of numpy.ndarray)

​ the image to detect faces from.

​ supported types: numpy.ndarray

Returns:

List[(int, int, int, int)]

​ The position of the bounding boxes for the faces detected.

List[float]

​ The confidence scores for the face detected in the bounding boxes.

More Resources