logo
Browse Source

Update for new pipe

Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
Jael Gu 2 years ago
parent
commit
06ef42a7e0
  1. 43
      README.md
  2. BIN
      result.png
  3. BIN
      results1.png
  4. BIN
      results2.png

43
README.md

@ -22,37 +22,40 @@ This operator uses [PyTorch.yolov5](https://pytorch.org/hub/ultralytics_yolov5/)
### Code Example ### Code Example
Load an image from path './test.png' and use yolov5 model to detect objects in the image.
*Write a same pipeline with explicit inputs/outputs name specifications:*
- Write the pipeline in the simplified way:
- **option 1: towhee>=0.9.0**
```Python ```Python
import towhee
towhee.glob('./test.png') \
.image_decode() \
.object_detection.yolov5() \
.show()
```
from towhee.dc2 import pipe, ops, DataCollection
<img src="./results1.png" alt="results1" height="40px"/>
p = (
pipe.input('path')
.map('path', 'img', ops.image_decode())
.map('img', ('box', 'class', 'score'), ops.object_detection.yolov5())
.map(('img', 'box'), 'object', ops.image_crop(clamp=True))
.output('img', 'object', 'class')
)
- Write the same pipeline with explicitly specified inputs and outputs:
DataCollection(p('./test.png')).show()
```
```Python
- **option 2:**
```python
import towhee import towhee
towhee.glob['path']('./test.png') \
.image_decode['path','img']() \
.object_detection.yolov5['img', ('box', 'class', 'score')]() \
.image_crop[('img', 'box'), 'object'](clamp = True) \
.select['img','object']() \
(
towhee.glob['path']('./test.png')
.image_decode['path','img']()
.object_detection.yolov5['img', ('box', 'class', 'score')]()
.image_crop[('img', 'box'), 'object'](clamp = True)
.select['img','object', 'class']()
.show() .show()
)
``` ```
<img src="./results2.png" alt="results1" height="140px"/>
<img src="./result.png" alt="result" height="140px"/>
<br /> <br />

BIN
result.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

BIN
results1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

BIN
results2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 KiB

Loading…
Cancel
Save