Browse Source
Update
Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
1 changed files with
9 additions and
8 deletions
-
README.md
|
@ -21,15 +21,16 @@ and use the pretrained SWAG model 'vit_b16_in1k' to generate an image embedding. |
|
|
*Write a pipeline with explicit inputs/outputs name specifications:* |
|
|
*Write a pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
|
```python |
|
|
```python |
|
|
import towhee |
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
|
|
|
towhee.glob['path']('./towhee.jpg') |
|
|
|
|
|
.image_decode['path', 'img']() |
|
|
|
|
|
.image_embedding.swag['img', 'vec'](model_name='vit_b16_in1k') |
|
|
|
|
|
.select['img', 'vec']() |
|
|
|
|
|
.show() |
|
|
|
|
|
|
|
|
from towhee.dc2 import pipe, ops, DataCollection |
|
|
|
|
|
|
|
|
|
|
|
p = ( |
|
|
|
|
|
pipe.input('path') |
|
|
|
|
|
.map('path', 'img', ops.image_decode()) |
|
|
|
|
|
.map('img', 'vec', ops.image_embedding.swag(model_name='vit_b16_in1k')) |
|
|
|
|
|
.output('img', 'vec') |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
DataCollection(p('towhee.jpeg')).show() |
|
|
``` |
|
|
``` |
|
|
<img src="./result.png" width="800px"/> |
|
|
<img src="./result.png" width="800px"/> |
|
|
|
|
|
|
|
|