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

Updated 2 years ago

towhee

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

shiyu22 baf284c0ee Update 8 Commits
folder-icon test_data Update 2 years ago
file-icon .gitattributes
840 B
download-icon
Update 2 years ago
file-icon .gitignore
3.0 KiB
download-icon
Update 2 years ago
file-icon README.md
1.8 KiB
download-icon
Update 2 years ago
file-icon __init__.py
592 B
download-icon
Update 2 years ago
file-icon image_embedding_operator_template.py
1.8 KiB
download-icon
Update 2 years ago
file-icon image_embedding_operator_template.yaml
371 B
download-icon
Update 2 years ago
file-icon requirements.txt
0 B
download-icon
Update 2 years ago
file-icon test_image_embedding_operator_template.py
338 B
download-icon
Update the test script 2 years ago