logo
Browse Source

Update

Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
Jael Gu 1 year ago
parent
commit
39fb17b4bf
  1. 34
      README.md
  2. BIN
      result.png

34
README.md

@ -13,34 +13,24 @@ This operator extracts features for images with [Multi-Path Vision Transformer (
## Code Example
Load an image from path './towhee.jpeg'
and use the pre-trained mpvit_base model to generate an image embedding.
*Write the pipeline in simplified style:*
```python
import towhee
towhee.glob('./towhee.jpeg') \
.image_decode() \
.image_embedding.mpvit(model_name='mpvit_base') \
.show()
```
![](result1.png)
Load an image from path 'towhee.jpeg'
and use the pre-trained 'mpvit_base' model to generate an image embedding.
*Write a same pipeline with explicit inputs/outputs name specifications:*
```python
import towhee
from towhee.dc2 import pipe, ops, DataCollection
p = (
pipe.input('path')
.map('path', 'img', ops.image_decode())
.map('img', 'vec', ops.image_embedding.mpvit(model_name='mpvit_base'))
.output('img', 'vec')
)
towhee.glob['path']('./towhee.jpeg') \
.image_decode['path', 'img']() \
.image_embedding.mpvit['img', 'vec'](model_name='mpvit_base') \
.select['img', 'vec']() \
.show()
DataCollection(p('towhee.jpeg')).show()
```
![](result2.png)
![](result.png)
<br />

BIN
result.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Loading…
Cancel
Save