logo
Browse Source

Update README

main
Kaiyuan Hu 3 years ago
parent
commit
d196939838
  1. 28
      README.md

28
README.md

@ -4,34 +4,34 @@ Authors: Kyle, shiyu22
## Overview ## Overview
This pipeline is used to **extract the feature vector of the image**, first to normalize the image , and then use resnet50 model to generate the vector.
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.
In fact, the pipeline runs by parsing [the yaml file](./image_embedding_resnet50.yaml), which declares some functions we call **Operator**, and the **DataFrame** required by each Operator. Next will introduce the interface, how to use it and how it works, have fun with it!
The pipeline parses [the yaml file](./image_embedding_resnet50.yaml), which declares some components we call **Operator** and **DataFrame**. Next, we will introduce the interface, show how to use it and how it works, have fun with it!
## Interface ## Interface
`towhee.pipeline(task: str, fmc: FileManagerConfig = FileManagerConfig(), branch: str = 'main', force_download: bool = False)` [source](https://github.com/towhee-io/towhee/blob/main/towhee/__init__.py)
`towhee.pipeline(task: str, fmc: FileManagerConfig = FileManagerConfig(), branch: str = 'main', force_download: bool = False)` [\[source\]](https://github.com/towhee-io/towhee/blob/main/towhee/__init__.py)
**param:**
**params:**
- **task**(str), task name or pipeline repo name.
- **fmc**(FileManagerConfig), optional file manager config for the local instance, default is FileManagerConfig().
- **branch**(str), which branch to use for operators/pipelines on hub, defaults to 'main'.
- **force_download**(bool), whether to redownload pipeline and operators, default is False.
- **task**(str): task name or pipeline repo name.
- **fmc**(FileManagerConfig): optional, file manager config for the local instance, default is a default FileManagerConfig obejct.
- **branch**(str): optional, which branch to use for operators/pipelines on hub, defaults to 'main'.
- **force_download**(bool): optional, whether to redownload pipeline and operators, default is False.
**return:** **return:**
- **_PipelineWrapper**, which is a wrapper class around `Pipeline`.
- **_PipelineWrapper**, an instance of the wrapper class around `Pipeline`.
When we declare a pipeline object with a specific task, such as `towhee/image-embedding-resnet50` in this repo, it will run according to the Yaml file, and the input and output are as follows:
When we declare a pipeline object with a specific task, such as `towhee/image-embedding-resnet50` in this repo, it will run according to the Yaml file, and the input and output are:
**inputs:** **inputs:**
- **img_tensor**(PIL.Image), image to be embedded.
- **img_tensor**(PIL.Image), the image to be encoded.
**outputs:** **outputs:**
- **cnn**(numpy.ndarray), the embedding of image.
- **cnn**(numpy.ndarray), the embedding of the image.
## How to use ## How to use
@ -41,7 +41,7 @@ When we declare a pipeline object with a specific task, such as `towhee/image-em
$ pip3 install towhee $ pip3 install towhee
``` ```
> You can refer to [Getting Started with Towhee](towhee.io) for more details. If you have questions, you can [submit an issue to the towhee repository](https://github.com/towhee-io/towhee/issues).
> You can refer to [Getting Started with Towhee](towhee.io) for more details. If you have any questions, you can [submit an issue to the towhee repository](https://github.com/towhee-io/towhee/issues).
2. Run it with Towhee 2. Run it with Towhee
@ -49,7 +49,7 @@ $ pip3 install towhee
>>> from towhee import pipeline >>> from towhee import pipeline
>>> from PIL import Image >>> from PIL import Image
>>> img = Image.open('./test_data/test.jpg')
>>> img = Image.open('path/to/your/image')
>>> embedding_pipeline = pipeline('towhee/image-embedding-resnet50') >>> embedding_pipeline = pipeline('towhee/image-embedding-resnet50')
>>> embedding = embedding_pipeline(img) >>> embedding = embedding_pipeline(img)
``` ```

Loading…
Cancel
Save