|
|
@ -4,19 +4,19 @@ |
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
## Desription |
|
|
|
## Description |
|
|
|
|
|
|
|
An image embedding operator generates a vector given an image. |
|
|
|
This operator extracts features for image with pretrained models provided by [Timm](https://github.com/rwightman/pytorch-image-models). |
|
|
|
This operator extracts features for image with pre-trained models provided by [Timm](https://github.com/rwightman/pytorch-image-models). |
|
|
|
Timm is a deep-learning library developed by [Ross Wightman](https://twitter.com/wightmanr), |
|
|
|
which maintains SOTA deep-learning models and tools in computer vision. |
|
|
|
who maintains SOTA deep-learning models and tools in computer vision. |
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
## Code Example |
|
|
|
|
|
|
|
Load an image from path './towhee.jpg' |
|
|
|
and use the pretrained ResNet50 model ('resnet50') to generate an image embedding. |
|
|
|
and use the pre-trained ResNet50 model ('resnet50') to generate an image embedding. |
|
|
|
|
|
|
|
*Write the pipeline in simplified style:* |
|
|
|
|
|
|
@ -47,7 +47,7 @@ towhee.glob['path']('./towhee.jpg') \ |
|
|
|
|
|
|
|
## Factory Constructor |
|
|
|
|
|
|
|
Create the operator via the following factory method |
|
|
|
Create the operator via the following factory method: |
|
|
|
|
|
|
|
***image_embedding.timm(model_name='resnet34', num_classes=1000, skip_preprocess=False)*** |
|
|
|
|
|
|
@ -56,7 +56,7 @@ Create the operator via the following factory method |
|
|
|
***model_name:*** *str* |
|
|
|
|
|
|
|
The model name in string. The default value is "resnet34". |
|
|
|
Refer [Timm Docs](https://fastai.github.io/timmdocs/#List-Models-with-Pretrained-Weights) to get a full list of supported models. |
|
|
|
Refer to [Timm Docs](https://fastai.github.io/timmdocs/#List-Models-with-Pretrained-Weights) to get a full list of supported models. |
|
|
|
|
|
|
|
***num_classes:*** *int* |
|
|
|
|
|
|
@ -65,7 +65,7 @@ It is related to model and dataset. |
|
|
|
|
|
|
|
***skip_preprocess:*** *bool* |
|
|
|
|
|
|
|
The flag to control whether to skip image preprocess. |
|
|
|
The flag to control whether to skip image pre-process. |
|
|
|
The default value is False. |
|
|
|
If set to True, it will skip image preprocessing steps (transforms). |
|
|
|
In this case, input image data must be prepared in advance in order to properly fit the model. |
|
|
|