Browse Source
update the readme.
Signed-off-by: wxywb <xy.wang@zilliz.com>
main
wxywb
2 years ago
1 changed files with
11 additions and
9 deletions
-
README.md
|
|
@ -22,18 +22,20 @@ An image crop operator implementation with OpenCV. |
|
|
|
|
|
|
|
Crop the face from 'avengers.jpg'. |
|
|
|
|
|
|
|
```python |
|
|
|
|
|
|
|
import towhee |
|
|
|
|
|
|
|
towhee.glob['path']('./avengers.jpg') \ |
|
|
|
.image_decode['path', 'img']() \ |
|
|
|
.face_detection.retinaface['img', ('box','score')]()\ |
|
|
|
.image_crop[('img', 'box'), 'crop'](clamp = True)\ |
|
|
|
.select['img','crop']()\ |
|
|
|
.show() |
|
|
|
``` |
|
|
|
from towhee.dc2 import pipe, ops, DataCollection |
|
|
|
|
|
|
|
p = ( |
|
|
|
pipe.input('path') |
|
|
|
.map('path', 'img', ops.image_decode()) |
|
|
|
.map('img', ('box','score'), ops.face_detection.retinaface()) |
|
|
|
.map(('img', 'box'), 'crop', ops.image_crop(clamp = True)) |
|
|
|
.output('img', 'crop') |
|
|
|
) |
|
|
|
|
|
|
|
DataCollection(p('./avengers.jpg')).show() |
|
|
|
``` |
|
|
|
|
|
|
|
<img src="./result2.png" height="150px"/> |
|
|
|
|
|
|
|