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. 45
      README.md
  2. BIN
      result.png
  3. BIN
      results1.png
  4. BIN
      results2.png

45
README.md

@ -22,37 +22,40 @@ This operator uses [PyTorch.yolov5](https://pytorch.org/hub/ultralytics_yolov5/)
### 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
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
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']() \
.show()
(
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()
)
```
<img src="./results2.png" alt="results1" height="140px"/>
<img src="./result.png" alt="result" height="140px"/>
<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