logo
Browse Source

Update

Signed-off-by: shiyu22 <shiyu.chen@zilliz.com>
main
shiyu22 3 years ago
parent
commit
baf284c0ee
  1. 6
      README.md
  2. 4
      image_embedding_operator_template.py
  3. 2
      image_embedding_operator_template.yaml

6
README.md

@ -32,9 +32,9 @@ __call__(self, img_tensor: torch.Tensor)
**Args:** **Args:**
- img_tensor:
- the input image tensor
- supported types: `torch.Tensor`
- img_path:
- path to the input image
- supported types: `str`
**Returns:** **Returns:**

4
image_embedding_operator_template.py

@ -36,7 +36,7 @@ class ImageEmbeddingOperatorTemplate(Operator):
# from pytorch import Model # from pytorch import Model
self.model = Model(model_name) self.model = Model(model_name)
def __call__(self, img_tensor: torch.Tensor) -> NamedTuple('Outputs', [('feature_vector', numpy.ndarray)]):
def __call__(self, img_path: str) -> NamedTuple('Outputs', [('feature_vector', numpy.ndarray)]):
""" """
Call it when use this class. Call it when use this class.
@ -48,6 +48,6 @@ class ImageEmbeddingOperatorTemplate(Operator):
The image embedding. The image embedding.
""" """
# call model with the img_tensor parameter # call model with the img_tensor parameter
result = self.model(img_tensor)
result = self.model(img_path)
Outputs = NamedTuple('Outputs', [('feature_vector', numpy.ndarray)]) Outputs = NamedTuple('Outputs', [('feature_vector', numpy.ndarray)])
return Outputs(result) return Outputs(result)

2
image_embedding_operator_template.yaml

@ -8,6 +8,6 @@ init:
model_name: str model_name: str
call: call:
input: input:
img_tensor: torch.Tensor
img_path: str
output: output:
feature_vector: numpy.ndarray feature_vector: numpy.ndarray
Loading…
Cancel
Save