Browse Source
Update
Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
3 changed files with
10 additions and
11 deletions
-
README.md
-
requirements.txt
-
BIN
result.png
|
|
@ -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` | |
|
|
|
| ----- | ------- | --------- | -------- | |
|
|
|
|  | `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() |
|
|
|
``` |
|
|
|
|
|
|
|
<img src="./result.png" alt="result" height="140px"/> |
|
|
|
|
|
|
|
## Factory Constructor |
|
|
|
|
|
|
|
|
|
@ -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 |
|
|
|
Width:
|
Height:
|
Size: 103 KiB
|