diff --git a/README.md b/README.md index 1a1742d..a6ea408 100644 --- a/README.md +++ b/README.md @@ -13,19 +13,19 @@ This operator uses Facebook's [Detectron2](https://github.com/facebookresearch/d ## Code Example ```python -import towhee +from towhee.dc2 import pipe, ops, DataCollection -towhee.glob('./example.jpg') \ - .image_decode() \ - .object_detection.detectron2(model_name='retinanet_resnet50') \ - .show() -``` - -| Image | `boxes` | `classes` | `scores` | -| ----- | ------- | --------- | -------- | -| ![](example.jpg) | `array([2645.9973, 1200.3245, 3176.163, 2722.6785])` | `array([0])` | `array([0.9998573])` | +p = ( + pipe.input('path') + .map('path', 'img', ops.image_decode()) + .map('img', ('boxes', 'classes', 'scores'), ops.object_detection.detectron2(model_name='retinanet_resnet50')) + .output('img', 'boxes', 'classes', 'scores') +) +DataCollection(p('./example.jpg')).show() +``` +result ## Factory Constructor diff --git a/requirements.txt b/requirements.txt index 115c696..d898f7e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,3 @@ torch >= 1.8 torchvision >= 0.9.0 black==21.4b2 detectron2@https://github.com/facebookresearch/detectron2/archive/refs/tags/v0.6.tar.gz -# detectron2@git+https://github.com/facebookresearch/detectron2.git@v0.6#egg=detectron2 diff --git a/result.png b/result.png new file mode 100644 index 0000000..37bb751 Binary files /dev/null and b/result.png differ