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.5 KiB

Image Embedding Pipeline with Resnet50

Authors: derekdqc, shiyu22

Overview

This pipeline is used to extract the feature vector of the image. First step is to normalize the image, and then use resnet50 model to generate the vector.

Interface

Args:

  • img_tensor(PIL.Image),

    The image to be encoded.

Returns:

  • (Tuple[('cnn', numpy.ndarray)])

    The embedding of the image.

How to use

  1. Install Towhee
$ pip3 install towhee

You can refer to Getting Started with Towhee for more details. If you have any questions, you can submit an issue to the towhee repository.

  1. Run it with Towhee
>>> from towhee import pipeline
>>> from PIL import Image

>>> img = Image.open('path/to/your/image') # for example, './test_data/test.jpg'
>>> embedding_pipeline = pipeline('towhee/image-embedding-resnet50')
>>> embedding = embedding_pipeline(img)

How it works

You can learn the pipeline and operator in Towhee architecture. This pipeline includes two main functions: towhee/transform-image and towhee/resnet50-image-embedding. It is necessary to ensure that the input and output of the four Operators correspond to each other, and the input and output data types can be defined by DataFrame.

img

1.5 KiB

Image Embedding Pipeline with Resnet50

Authors: derekdqc, shiyu22

Overview

This pipeline is used to extract the feature vector of the image. First step is to normalize the image, and then use resnet50 model to generate the vector.

Interface

Args:

  • img_tensor(PIL.Image),

    The image to be encoded.

Returns:

  • (Tuple[('cnn', numpy.ndarray)])

    The embedding of the image.

How to use

  1. Install Towhee
$ pip3 install towhee

You can refer to Getting Started with Towhee for more details. If you have any questions, you can submit an issue to the towhee repository.

  1. Run it with Towhee
>>> from towhee import pipeline
>>> from PIL import Image

>>> img = Image.open('path/to/your/image') # for example, './test_data/test.jpg'
>>> embedding_pipeline = pipeline('towhee/image-embedding-resnet50')
>>> embedding = embedding_pipeline(img)

How it works

You can learn the pipeline and operator in Towhee architecture. This pipeline includes two main functions: towhee/transform-image and towhee/resnet50-image-embedding. It is necessary to ensure that the input and output of the four Operators correspond to each other, and the input and output data types can be defined by DataFrame.

img