From 2cbd683c0ade2636f9c9c4419c497b1659cf1010 Mon Sep 17 00:00:00 2001 From: wxywb Date: Thu, 2 Feb 2023 12:31:37 +0000 Subject: [PATCH] update the readme. Signed-off-by: wxywb --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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() +```