logo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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_tensor:
    • the input image tensor
    • supported types: torch.Tensor

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_tensor:
    • the input image tensor
    • supported types: torch.Tensor

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