logo
Browse Source

Update

Signed-off-by: shiyu22 <shiyu.chen@zilliz.com>
main
shiyu22 3 years ago
parent
commit
5017c5e8ce
  1. 8
      README.md
  2. 26
      image_embedding_pipeline_template.yaml
  3. BIN
      readme_res/pipeline.png

8
README.md

@ -8,7 +8,7 @@ Authors:
This pipeline **cannot be run**, which is the **template for the image embedding pipeline class** and defines YAML template file for embedding images, as well as the standard inputs and outputs. You can complete the pipeline by filling in the parameters(`init_args`) of the Operator section in [image_embedding_pipeline_template.yaml](./image_embedding_pipeline_template.yaml) and update this README file. FYI, [image-embedding-resnet50](https://hub.towhee.io/towhee/image-embedding-resnet50) is based on this template. This pipeline **cannot be run**, which is the **template for the image embedding pipeline class** and defines YAML template file for embedding images, as well as the standard inputs and outputs. You can complete the pipeline by filling in the parameters(`init_args`) of the Operator section in [image_embedding_pipeline_template.yaml](./image_embedding_pipeline_template.yaml) and update this README file. FYI, [image-embedding-resnet50](https://hub.towhee.io/towhee/image-embedding-resnet50) is based on this template.
This pipeline is used to **extract the feature vector of the image**. It first normalizes the image and then uses a model to generate the vector.
This pipeline is used to **extract the feature vector of the image**. It uses XX model to generate the vector.
## Interface ## Interface
@ -20,7 +20,7 @@ This pipeline is used to **extract the feature vector of the image**. It first n
**Pipeline Output:** **Pipeline Output:**
The pipeline returns a tuple `Tuple[('cnn', numpy.ndarray)]` containing following fields:
The pipeline returns a tuple `Tuple[('feature_vector', numpy.ndarray)]` containing following fields:
- feature_vector: - feature_vector:
- the embedding of input image - the embedding of input image
@ -42,12 +42,12 @@ $ pip3 install towhee
>>> from towhee import pipeline >>> from towhee import pipeline
>>> embedding_pipeline = pipeline('user/repo_name') #the pipeline repo, such as 'towhee/image-embedding-resnet50' >>> embedding_pipeline = pipeline('user/repo_name') #the pipeline repo, such as 'towhee/image-embedding-resnet50'
>>> embedding = embedding_pipeline('path/to/your/image')
>>> embedding = embedding_pipeline('path/to/your/image') #such as './readme_res/pipeline.png'
``` ```
## **How it works** ## **How it works**
This pipeline includes two main operators: [transform image](https://hub.towhee.io/towhee/transform-image-operator-template) and [image embedding](https://hub.towhee.io/towhee/image-embedding-operator-template). 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 one operator: [image embedding](https://hub.towhee.io/towhee/image-embedding-operator-template). The image will be encoded via image embedding operator, then we can 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. > Refer [Towhee architecture](https://github.com/towhee-io/towhee#towhee-architecture) for basic concepts in Towhee: pipeline, operator, dataframe.

26
image_embedding_pipeline_template.yaml

@ -14,22 +14,6 @@ operators:
df: 'image' df: 'image'
iter_info: iter_info:
type: map type: map
-
name: 'preprocessing'
function: 'towhee/image-transform-template' #your transform-image repo name
tag: 'main' #tag to the repo, default is 'main'
init_args:
size: #size of image, such as 256
inputs:
-
df: 'image'
name: 'img_path'
col: 0
outputs:
-
df: 'image_preproc'
iter_info:
type: map
- -
name: embedding_model name: embedding_model
function: 'towhee/image-embedding-operator-template' #your image-embedding repo name function: 'towhee/image-embedding-operator-template' #your image-embedding repo name
@ -38,8 +22,8 @@ operators:
model_name: #model_name for image-embedding operator, such as 'resnet50' model_name: #model_name for image-embedding operator, such as 'resnet50'
inputs: inputs:
- -
df: 'image_preproc'
name: 'img_tensor'
df: 'image'
name: 'img_path'
col: 0 col: 0
outputs: outputs:
- -
@ -73,12 +57,6 @@ dataframes:
- -
name: 'img_path' name: 'img_path'
vtype: 'str' vtype: 'str'
-
name: 'image_preproc'
columns:
-
name: 'img_transformed'
vtype: 'torch.Tensor'
- -
name: 'embedding' name: 'embedding'
columns: columns:

BIN
readme_res/pipeline.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

After

Width:  |  Height:  |  Size: 215 KiB

Loading…
Cancel
Save