Browse Source
Update
Signed-off-by: shiyu22 <shiyu.chen@zilliz.com>
main
3 changed files with
5 additions and
8 deletions
-
README.md
-
image_embedding_pipeline_template.yaml
-
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_tensor: |
|
|
|
|
|
|
|
|
- img: |
|
|
- the input image to be encoded |
|
|
- the input image to be encoded |
|
|
- supported types: `PIL.Image` |
|
|
|
|
|
|
|
|
- supported types: `str` |
|
|
|
|
|
|
|
|
**Pipeline Output:** |
|
|
**Pipeline Output:** |
|
|
|
|
|
|
|
|
|
@ -66,13 +66,13 @@ dataframes: |
|
|
columns: |
|
|
columns: |
|
|
- |
|
|
- |
|
|
name: 'img' |
|
|
name: 'img' |
|
|
vtype: 'PIL.Image' |
|
|
|
|
|
|
|
|
vtype: 'str' |
|
|
- |
|
|
- |
|
|
name: 'image' |
|
|
name: 'image' |
|
|
columns: |
|
|
columns: |
|
|
- |
|
|
- |
|
|
name: 'img' |
|
|
name: 'img' |
|
|
vtype: 'PIL.Image' |
|
|
|
|
|
|
|
|
vtype: 'str' |
|
|
- |
|
|
- |
|
|
name: 'image_preproc' |
|
|
name: 'image_preproc' |
|
|
columns: |
|
|
columns: |
|
|
|
@ -1,17 +1,14 @@ |
|
|
import unittest |
|
|
import unittest |
|
|
from towhee import pipeline |
|
|
from towhee import pipeline |
|
|
from PIL import Image |
|
|
|
|
|
from config import DIMENSION, REPO_NAME, TEST_IMG |
|
|
from config import DIMENSION, REPO_NAME, TEST_IMG |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestImageEmbeddingPipelineClass(unittest.TestCase): |
|
|
class TestImageEmbeddingPipelineClass(unittest.TestCase): |
|
|
test_img = Image.open(TEST_IMG) |
|
|
|
|
|
|
|
|
|
|
|
def test_image_embedding_resnet50(self): |
|
|
def test_image_embedding_resnet50(self): |
|
|
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(self.TEST_IMG) |
|
|
assert (1, self.dimension)==op(img_tensor)[0].shape |
|
|
assert (1, self.dimension)==op(img_tensor)[0].shape |
|
|
|
|
|
|
|
|
|
|
|
|
|
|