logo
Browse Source

Update

Signed-off-by: shiyu22 <shiyu.chen@zilliz.com>
main
shiyu22 3 years ago
parent
commit
d8a59c1ac2
  1. 4
      README.md
  2. 4
      image_embedding_pipeline_template.yaml
  3. 5
      test_image_embedding_pipeline_yaml.py

4
README.md

@ -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:**

4
image_embedding_pipeline_template.yaml

@ -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:

5
test_image_embedding_pipeline_yaml.py

@ -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

Loading…
Cancel
Save