logo
Browse Source

update the readme.

Signed-off-by: wxywb <xy.wang@zilliz.com>
main
wxywb 2 years ago
parent
commit
7d5214ffcd
  1. 28
      README.md

28
README.md

@ -18,29 +18,19 @@ This operator extracts features for image with [data2vec](https://arxiv.org/abs/
Load an image from path './towhee.jpg' to generate an image embedding. Load an image from path './towhee.jpg' to generate an image embedding.
*Write the pipeline in simplified style*:
*Write a pipeline with explicit inputs/outputs name specifications:*
```python ```python
import towhee
from towhee.dc2 import pipe, ops, DataCollection
towhee.glob('./towhee.jpg') \
.image_decode.cv2() \
.image_embedding.data2vec(model_name='facebook/data2vec-vision-base-ft1k') \
.show()
p = (
pipe.input('path')
.map('path', 'img', ops.image_decode())
.map('img', 'vec', ops.image_embedding.data2vec(model_name='facebook/data2vec-vision-base-ft1k'))
.output('img', 'vec')
)
```
<img src="./result1.png" alt="result1" style="height:20px;"/>
*Write a same pipeline with explicit inputs/outputs name specifications:*
```python
import towhee
towhee.glob['path']('./towhee.jpg') \
.image_decode.cv2['path', 'img']() \
.image_embedding.data2vec['img', 'vec'](model_name='facebook/data2vec-vision-base-ft1k') \
.select['img', 'vec']() \
.show()
DataCollection(p('towhee.jpeg')).show()
``` ```
<img src="./result2.png" alt="result2" style="height:60px;"/> <img src="./result2.png" alt="result2" style="height:60px;"/>

Loading…
Cancel
Save