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 Preprocessing Operator

Authors:

Overview

Note: this is just a template, not a runnable pipeline.

This transform image operator class defines image embedding functions, as well as the standard inputs and outputs. You can complete the operator by filling in functions (__init__ & __call__) in transform_image_operator_template.py and update this README file. FYI, transform-image is based on this template.

This operator is used to transform the image, such as cropping, PIL.Image and Tensor conversion, normalization and other operations on the image.

Interface

__init__(self, size: int)

Args:

  • size:
    • The size of the output image
    • supported types: int
int__call__(self, img_path: Union[Image.Image, torch.Tensor, str])

Args:

  • img_path:
    • the input image to be processed
    • supported type: PIL.image, torch.Tensor or str (path of the image)

Returns:

The Operator returns a tuple Tuple[('img_transformed', torch.Tensor)] containing following fields:

  • img_transformed:
    • the tensor of the transformed image
    • data type: torch.Tensor

Requirements

You can get the required python package by requirements.txt.

How it works

The towhee/transform-image-operator-template Operator is used for image transformation and is an important part of data preprocessing. It can be added to the pipeline and is usually used as the first custom operator of the pipeline. For example, it's the first Operator named processing within image-embedding-pipeline-template pipeline.

Reference

shiyu22 df00bba97b Update the test script 6 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 requirements.txt
0 B
download-icon
Update 2 years ago
file-icon test_transform_image_operator_template.py
818 B
download-icon
Update the test script 2 years ago
file-icon transform_image_operator_template.py
1.3 KiB
download-icon
Update 2 years ago
file-icon transform_image_operator_template.yaml
323 B
download-icon
Update 2 years ago