|
|
@ -20,30 +20,20 @@ This operator detects faces in the images by using [RetinaFace](https://arxiv.or |
|
|
|
|
|
|
|
Load an image from path './turing.png' and use the pre-trained RetinaFace model to generate face bounding boxes and confidence scores. |
|
|
|
|
|
|
|
*Write the pipeline in simplified style:* |
|
|
|
*Write a pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
```python |
|
|
|
import towhee |
|
|
|
from towhee.dc2 import pipe, ops, DataCollection |
|
|
|
|
|
|
|
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() |
|
|
|
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() |
|
|
|
``` |
|
|
|
|
|
|
|
<img src="https://towhee.io/face-detection/retinaface/raw/branch/main/result2.jpg" alt="result2" style="height:60px;"/> |
|
|
|