|
@ -50,33 +50,34 @@ Create the operator via the following factory method |
|
|
|
|
|
|
|
|
**Parameters:** |
|
|
**Parameters:** |
|
|
|
|
|
|
|
|
***model_name***: *str* |
|
|
|
|
|
|
|
|
***model_name***: *str* |
|
|
|
|
|
|
|
|
The model name in string. The default value is "resnet34". |
|
|
|
|
|
|
|
|
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 [Timm Docs](https://fastai.github.io/timmdocs/#List-Models-with-Pretrained-Weights) to get a full list of supported models. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
***num_classes***: *int* |
|
|
|
|
|
|
|
|
***num_classes***: *int* |
|
|
|
|
|
|
|
|
The number of classes. The default value is 1000. |
|
|
|
|
|
|
|
|
The number of classes. The default value is 1000. |
|
|
It is related to model and dataset. |
|
|
It is related to model and dataset. |
|
|
|
|
|
|
|
|
***skip_preprocess***: *bool* |
|
|
***skip_preprocess***: *bool* |
|
|
|
|
|
|
|
|
Flag to control whether to skip image preprocess, defaults to False. |
|
|
|
|
|
If set to True, image preprocess steps such as transform, normalization will be skipped. |
|
|
|
|
|
In this case, the user should guarantee that all the input images are already reprocessed properly, and thus can be fed to model directly. |
|
|
|
|
|
|
|
|
The flag to control whether to skip image preprocess. |
|
|
|
|
|
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. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Interface |
|
|
## Interface |
|
|
|
|
|
|
|
|
An image embedding operator takes an image in ndarray as input. |
|
|
|
|
|
|
|
|
An image embedding operator takes a [towhee image](link/to/towhee/image/api/doc) as input. |
|
|
It uses the pre-trained model specified by model name to generate an image embedding in ndarray. |
|
|
It uses the pre-trained model specified by model name to generate an image embedding in ndarray. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:** |
|
|
**Parameters:** |
|
|
|
|
|
|
|
|
***img***: *[towhee.types.Image]()* |
|
|
|
|
|
|
|
|
***img***: *towhee.types.Image* |
|
|
|
|
|
|
|
|
The decoded image data in towhee.types.Image (numpy.ndarray). |
|
|
The decoded image data in towhee.types.Image (numpy.ndarray). |
|
|
|
|
|
|
|
|