From aa188560a13eaf7d34d3c20cb24f97d58a1c130f Mon Sep 17 00:00:00 2001 From: shiyu22 Date: Mon, 13 Dec 2021 17:54:18 +0800 Subject: [PATCH] Update README Signed-off-by: shiyu22 --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 21b35f8..0d9d278 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,26 @@ -# Image Embedding Pipeline with Resnet50 +# Pipeline: Image Embedding using Resnet50 Authors: derekdqc, shiyu22 ## Overview -This pipeline is used to **extract the feature vector of a given image**. - -The pipeline performs two major steps. First, normalize the image, and then use resnet50 model to generate the vector. +The pipeline is used to **extract the feature vector of a given image**. It first normalizes the image and then uses Resnet50 model to generate the vector. ## Interface -**Pipeline Input Arguments:** - -- img(`PIL.Image`): +**Input Arguments:** - The image to be encoded. `PIL.Image` is the currently supported image type. +- image: + - the input image to be encoded + - supported types: `PIL.Image` -**Pipeline Returns:** +**Pipeline Output:** -- (`Tuple[('cnn', numpy.ndarray)]`) +The pipeline returns a tuple `Tuple[('feature_vector', numpy.ndarray)]` containing following fields: - The pipeline returns a tuple. - - - The `feature_vector` field contains the embedding of the image. +- feature_vector: + - the embedding of input image + - data type: `numpy.ndarray` ## How to use @@ -40,13 +38,15 @@ $ pip3 install towhee >>> from towhee import pipeline >>> from PIL import Image ->>> img = Image.open('path/to/your/image') # for example, './test_data/test.jpg' +>>> img = Image.open('path/to/your/image') # for example, './test.jpg' >>> embedding_pipeline = pipeline('towhee/image-embedding-resnet50') >>> embedding = embedding_pipeline(img) ``` ## How it works -This pipeline includes two main operators: transform image (implemented as [towhee/transform-image](https://hub.towhee.io/towhee/transform-image)) and image embedding (implemented as [towhee/resnet50-image-embedding](https://hub.towhee.io/towhee/resnet50-image-embedding)). The transform image operator will first convert the original image into a normalized format, such as with 512x512 resolutions. Then, the normalized image will be encoded via image embedding operator, and finally we get a feature vector of the given image. (The basic concepts of pipeline and operator are introduced in [Towhee architecture](https://github.com/towhee-io/towhee#towhee-architecture).) +This pipeline includes two main operators: [transform image](https://hub.towhee.io/towhee/transform-image-operator-class) (implemented as [towhee/transform-image](https://hub.towhee.io/towhee/transform-image)) and [image embedding](https://hub.towhee.io/towhee/image-embedding-operator-class) (implemented as [towhee/resnet50-image-embedding](https://hub.towhee.io/towhee/resnet50-image-embedding)). The transform image op will first convert the original image into a normalized format, such as with 512x512 resolutions. Then, the normalized image will be encoded via image embedding op, and finally we get a feature vector of the given image. + +> Refer [Towhee architecture](https://github.com/towhee-io/towhee#towhee-architecture) for basic concepts in Towhee: pipeline, operator, dataframe. ![img](./readme_res/pipeline.png)