From fed371b4b2a4deb56a2e5884a5244cc4e4d5d169 Mon Sep 17 00:00:00 2001 From: shiyu22 Date: Wed, 15 Dec 2021 14:58:24 +0800 Subject: [PATCH] Update Signed-off-by: shiyu22 --- README.md | 10 ++++++---- image_embedding_resnet50.yaml | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 495e306..4569711 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Pipeline: Image Embedding using Resnet50 +# Pipeline: Image Embedding using Resnet Authors: derekdqc, shiyu22 ## Overview -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. +The pipeline is used to **extract the feature vector of a given image**. It first normalizes the image and then uses Resnet model to generate the vector. ## Interface @@ -39,13 +39,15 @@ $ pip3 install towhee >>> from PIL import Image >>> img = Image.open('path/to/your/image') # for example, './test.jpg' ->>> embedding_pipeline = pipeline('towhee/image-embedding-resnet50') +>>> embedding_pipeline = pipeline('towhee/image-embedding-resnet') >>> embedding = embedding_pipeline(img) ``` +> This pipeline uses the resnet50 model, you can also change the parameters `resnet50` in the local file **~/.towhee/image_embedding_resnet50&towhee$main/image_embedding_resnet.yaml** to the `resnet101` model. + ## How it works -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 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. +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/resnet-image-embedding](https://hub.towhee.io/towhee/resnet-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. > Refer [Towhee architecture](https://github.com/towhee-io/towhee#towhee-architecture) for basic concepts in Towhee: pipeline, operator, dataframe. diff --git a/image_embedding_resnet50.yaml b/image_embedding_resnet50.yaml index 40bbf44..ad6ff6c 100644 --- a/image_embedding_resnet50.yaml +++ b/image_embedding_resnet50.yaml @@ -1,4 +1,4 @@ -name: 'image-embedding-resnet50' +name: 'image-embedding-resnet' operators: - name: '_start_op' @@ -32,7 +32,7 @@ operators: type: map - name: 'embedding_model' - function: 'towhee/resnet50-image-embedding' # same as 'resnet50-image-embedding', default user is towhee + function: 'towhee/resnet-image-embedding' # same as 'resnet50-image-embedding', default user is towhee tag: 'main' # optional init_args: model_name: 'resnet50'