Browse Source
Update
Signed-off-by: shiyu22 <shiyu.chen@zilliz.com>
main
4 changed files with
8 additions and
10 deletions
-
README.md
-
image_embedding_pipeline_template.yaml
-
BIN
readme_res/pipeline.png
-
test_image_embedding_pipeline_yaml.py
|
@ -14,9 +14,9 @@ This pipeline is used to **extract the feature vector of the image**. It first n |
|
|
|
|
|
|
|
|
**Input Arguments:** |
|
|
**Input Arguments:** |
|
|
|
|
|
|
|
|
- img: |
|
|
|
|
|
|
|
|
- img_path: |
|
|
- the input image to be encoded |
|
|
- the input image to be encoded |
|
|
- supported types: `str` |
|
|
|
|
|
|
|
|
- supported types: `str` (path of the image) |
|
|
|
|
|
|
|
|
**Pipeline Output:** |
|
|
**Pipeline Output:** |
|
|
|
|
|
|
|
@ -40,11 +40,9 @@ $ pip3 install towhee |
|
|
|
|
|
|
|
|
```Python |
|
|
```Python |
|
|
>>> from towhee import pipeline |
|
|
>>> from towhee import pipeline |
|
|
>>> from PIL import Image |
|
|
|
|
|
|
|
|
|
|
|
>>> img = Image.open('path/to/your/image') #for example './test.jpg' |
|
|
|
|
|
>>> embedding_pipeline = pipeline('user/repo_name') #the pipeline repo, such as 'towhee/image-embedding-resnet50' |
|
|
>>> embedding_pipeline = pipeline('user/repo_name') #the pipeline repo, such as 'towhee/image-embedding-resnet50' |
|
|
>>> embedding = embedding_pipeline(img) |
|
|
|
|
|
|
|
|
>>> embedding = embedding_pipeline('path/to/your/image') |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
## **How it works** |
|
|
## **How it works** |
|
|
|
@ -7,7 +7,7 @@ operators: |
|
|
inputs: |
|
|
inputs: |
|
|
- |
|
|
- |
|
|
df: '_start_df' |
|
|
df: '_start_df' |
|
|
name: 'img' |
|
|
|
|
|
|
|
|
name: 'img_path' |
|
|
col: 0 |
|
|
col: 0 |
|
|
outputs: |
|
|
outputs: |
|
|
- |
|
|
- |
|
@ -23,7 +23,7 @@ operators: |
|
|
inputs: |
|
|
inputs: |
|
|
- |
|
|
- |
|
|
df: 'image' |
|
|
df: 'image' |
|
|
name: 'img' |
|
|
|
|
|
|
|
|
name: 'img_path' |
|
|
col: 0 |
|
|
col: 0 |
|
|
outputs: |
|
|
outputs: |
|
|
- |
|
|
- |
|
@ -65,13 +65,13 @@ dataframes: |
|
|
name: '_start_df' |
|
|
name: '_start_df' |
|
|
columns: |
|
|
columns: |
|
|
- |
|
|
- |
|
|
name: 'img' |
|
|
|
|
|
|
|
|
name: 'img_path' |
|
|
vtype: 'str' |
|
|
vtype: 'str' |
|
|
- |
|
|
- |
|
|
name: 'image' |
|
|
name: 'image' |
|
|
columns: |
|
|
columns: |
|
|
- |
|
|
- |
|
|
name: 'img' |
|
|
|
|
|
|
|
|
name: 'img_path' |
|
|
vtype: 'str' |
|
|
vtype: 'str' |
|
|
- |
|
|
- |
|
|
name: 'image_preproc' |
|
|
name: 'image_preproc' |
|
|
Width:
|
Height:
|
Size: 238 KiB
Width:
|
Height:
|
Size: 264 KiB
|
|
@ -8,7 +8,7 @@ class TestImageEmbeddingPipelineClass(unittest.TestCase): |
|
|
self.dimension = DIMENSION #the dimension of image embedding |
|
|
self.dimension = DIMENSION #the dimension of image embedding |
|
|
self.repo_name = REPO_NAME |
|
|
self.repo_name = REPO_NAME |
|
|
embedding_pipeline = pipeline(self.repo_name) |
|
|
embedding_pipeline = pipeline(self.repo_name) |
|
|
embedding = embedding_pipeline(self.TEST_IMG) |
|
|
|
|
|
|
|
|
embedding = embedding_pipeline(TEST_IMG) |
|
|
assert (1, self.dimension)==op(img_tensor)[0].shape |
|
|
assert (1, self.dimension)==op(img_tensor)[0].shape |
|
|
|
|
|
|
|
|
|
|
|
|
|
|