towhee
Readme
Files and versions
1.8 KiB
Template: Image Embedding Operator
Authors:
Overview
Note: this is just a template, not a runnable pipeline.
This class template for the image embedding operator defines the image embedding functions, as well as the standard inputs and outputs. You can complete the operator by filling in the function(__init__
, __call__
) in image_embedding_operator_template.py and update this README file. FYI, image-embedding-resnet50 is based on this template.
This Operator generates feature vectors from "someone" model, which is trained on "someone" dataset.
Interface
__init__(self, model_name: str, framework: str = 'pytorch')
Args:
-
model_name:
- the model name for embedding
- supported types:
str
, for example 'resnet50'
-
framework:
- the framework of the model
- supported types:
str
, default is 'pytorch'
__call__(self, img_tensor: torch.Tensor)
Args:
- img_path:
- path to the input image
- supported types:
str
Returns:
The Operator returns a tuple Tuple[('feature_vector', numpy.ndarray)]
containing following fields:
- feature_vector:
- the embedding of the image
- data type:
numpy.ndarray
Requirements
You can get the required python package by requirements.txt.
How it works
The towhee/image-embedding-operator-template
Operator implements the function of image embedding, which can add to the pipeline. For example, it's the key Operator named embedding_model within image-embedding-pipeline-template pipeline.
Reference
1.8 KiB
Template: Image Embedding Operator
Authors:
Overview
Note: this is just a template, not a runnable pipeline.
This class template for the image embedding operator defines the image embedding functions, as well as the standard inputs and outputs. You can complete the operator by filling in the function(__init__
, __call__
) in image_embedding_operator_template.py and update this README file. FYI, image-embedding-resnet50 is based on this template.
This Operator generates feature vectors from "someone" model, which is trained on "someone" dataset.
Interface
__init__(self, model_name: str, framework: str = 'pytorch')
Args:
-
model_name:
- the model name for embedding
- supported types:
str
, for example 'resnet50'
-
framework:
- the framework of the model
- supported types:
str
, default is 'pytorch'
__call__(self, img_tensor: torch.Tensor)
Args:
- img_path:
- path to the input image
- supported types:
str
Returns:
The Operator returns a tuple Tuple[('feature_vector', numpy.ndarray)]
containing following fields:
- feature_vector:
- the embedding of the image
- data type:
numpy.ndarray
Requirements
You can get the required python package by requirements.txt.
How it works
The towhee/image-embedding-operator-template
Operator implements the function of image embedding, which can add to the pipeline. For example, it's the key Operator named embedding_model within image-embedding-pipeline-template pipeline.