diff --git a/README.md b/README.md index 047f520..f8816e7 100644 --- a/README.md +++ b/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() +```