提交 ae6f1a9b 编写于 作者: C chenjian

add English readme

上级 b3f19bfc
# DriverStatusRecognition
|Module Name|DriverStatusRecognition|
| :--- | :---: |
|Category|image classification|
|Network|MobileNetV3_small_ssld|
|Dataset|分心司机检测Dataset|
|Fine-tuning supported or not|No|
|Module Size|6MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- 驾驶员状态识别(DriverStatusRecognition),该模型可挖掘出人在疲劳状态下的表情特征,然后将这些定性的表情特征进行量化,提取出面部特征点及特征指标作为判断依据,再结合实验数据总结出基于这些Parameters的识别方法,最后输入获取到的状态数据进行识别和判断.该PaddleHub Module支持API预测及命令行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 2.0.0
- paddlehub >= 2.0.0 | [How to install PaddleHub]()
- paddlex >= 1.3.7
- ### 2、Installation
- ```shell
$ hub install DriverStatusRecognition
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
- ### 3、在线体验
[AI Studio 快速体验](https://aistudio.baidu.com/aistudio/projectdetail/1649513)
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run DriverStatusRecognition --input_path /PATH/TO/IMAGE
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="DriverStatusRecognition")
images = [cv2.imread('/PATH/TO/IMAGE')]
results = classifier.predict(images=images)
for result in results:
print(result)
```
- ### 3、API
- ```python
def predict(images)
```
- classification API.
- **Parameters**
- images:list类型,待检测的图像.
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install DriverStatusRecognition==1.0.0
```
# SnakeIdentification
|Module Name|SnakeIdentification|
| :--- | :---: |
|Category|image classification|
|Network|ResNet50_vd_ssld|
|Dataset|蛇种Dataset|
|Fine-tuning supported or not|No|
|Module Size|84MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- 蛇种识别(SnakeIdentification),该模型可准确识别蛇的种类,并精准判断蛇的毒性.该PaddleHub Module支持API预测及命令行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 2.0.0
- paddlehub >= 2.0.0 | [How to install PaddleHub]()
- paddlex >= 1.3.7
- ### 2、Installation
- ```shell
$ hub install SnakeIdentification
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
- ### 3、在线体验
[AI Studio 快速体验](https://aistudio.baidu.com/aistudio/projectdetail/1646951)
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run SnakeIdentification --input_path /PATH/TO/IMAGE
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="SnakeIdentification")
images = [cv2.imread('/PATH/TO/IMAGE')]
results = classifier.predict(images=images)
for result in results:
print(result)
```
- ### 3、API
- ```python
def predict(images)
```
- classification API.
- **Parameters**
- images:list类型,待检测的图像.
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install SnakeIdentification==1.0.0
```
# alexnet_imagenet
|Module Name|alexnet_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|AlexNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|234MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- AlexNet是图像分类中的经典模型.模型由Alex Krizhevsky于2012年提出,并在2012年ILSVRC比赛中夺得冠军.该PaddleHub Module结构为AlexNet,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install alexnet_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run alexnet_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="alexnet_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install alexnet_imagenet==1.0.0
```
# darknet53_imagenet
|Module Name|darknet53_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DarkNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|160MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DarkNet 是由 Joseph Redmon 提出的图像分类模型,并应用于Yolov3 中作为 Backbone 来完成特征提取.该网络采用连续的 3*3 和 1*1 卷积进行连接,并像ResNet 一样有ShortCut连接.该 PaddleHub Module 基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install darknet53_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run darknet53_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="darknet53_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install darknet53_imagenet==1.0.0
```
# densenet121_imagenet
|Module Name|densenet121_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DenseNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|34MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接.对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入.DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了Parameters量.该PaddleHub Module结构为 DenseNet121,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install densenet121_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run densenet121_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="densenet121_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install densenet121_imagenet==1.0.0
```
# densenet161_imagenet
|Module Name|densenet161_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DenseNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|114MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接.对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入.DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了Parameters量.该PaddleHub Module结构为 DenseNet161,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install densenet161_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run densenet161_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="densenet161_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install densenet161_imagenet==1.0.0
```
# densenet169_imagenet
|Module Name|densenet169_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DenseNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|59MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接.对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入.DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了Parameters量.该PaddleHub Module结构为 DenseNet169,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install densenet169_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run densenet169_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="densenet169_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install densenet169_imagenet==1.0.0
```
# densenet201_imagenet
|Module Name|densenet201_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DenseNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|82MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接.对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入.DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了Parameters量.该PaddleHub Module结构为 DenseNet201,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install densenet201_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run densenet201_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="densenet201_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install densenet201_imagenet==1.0.0
```
# densenet264_imagenet
|Module Name|densenet264_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DenseNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|135MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接.对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入.DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了Parameters量.该PaddleHub Module结构为 DenseNet264,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install densenet264_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run densenet264_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="densenet264_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install densenet264_imagenet==1.0.0
```
# dpn107_imagenet
|Module Name|dpn107_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DPN|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|335MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想.该PaddleHub Module结构为 DPN107,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install dpn107_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run dpn107_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="dpn107_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install dpn107_imagenet==1.0.0
```
# dpn131_imagenet
|Module Name|dpn131_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DPN|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|306MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想.该PaddleHub Module结构为 DPN98,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install dpn131_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run dpn131_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="dpn131_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install dpn131_imagenet==1.0.0
```
# dpn68_imagenet
|Module Name|dpn68_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DPN|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|50MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想.该PaddleHub Module结构为 DPN68,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install dpn68_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run dpn68_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="dpn68_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install dpn68_imagenet==1.0.0
```
# dpn92_imagenet
|Module Name|dpn92_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DPN|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|146MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想.该PaddleHub Module结构为 DPN92,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install dpn92_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run dpn92_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="dpn92_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install dpn92_imagenet==1.0.0
```
# dpn98_imagenet
|Module Name|dpn98_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|DPN|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|238MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想.该PaddleHub Module结构为 DPN98,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install dpn98_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run dpn98_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="dpn98_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install dpn98_imagenet==1.0.0
```
# efficientnetb0_imagenet
|Module Name|efficientnetb0_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|EfficientNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|22MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- EfficientNet is a light-weight model proposed by google, which consists of MBConv, and takes advantage of squeeze-and-excitation operation. This module is based on EfficientNetB0, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install efficientnetb0_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run efficientnetb0_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="efficientnetb0_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m efficientnetb0_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/efficientnetb0_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
* 1.1.0
Improve the prediction performance and users' experience
- ```shell
$ hub install efficientnetb0_imagenet==1.1.0
```
# efficientnetb0_small_imagenet
|Module Name|efficientnetb0_small_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|EfficientNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|20MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- EfficientNet is a light-weight model proposed by google, which consists of MBConv, and takes advantage of squeeze-and-excitation operation. This module is based on EfficientNetB0, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install efficientnetb0_small_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run efficientnetb0_small_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="efficientnetb0_small_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m efficientnetb0_small_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/efficientnetb0_small_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install efficientnetb0_small_imagenet==1.0.0
```
# efficientnetb1_imagenet
|Module Name|efficientnetb1_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|EfficientNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|33MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- EfficientNet is a light-weight model proposed by google, which consists of MBConv, and takes advantage of squeeze-and-excitation operation. This module is based on EfficientNetB1, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install efficientnetb1_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run efficientnetb1_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="efficientnetb1_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m efficientnetb1_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/efficientnetb1_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
* 1.1.0
Improve the prediction performance and users' experience
- ```shell
$ hub install efficientnetb1_imagenet==1.1.0
```
# efficientnetb2_imagenet
|Module Name|efficientnetb2_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|EfficientNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|38MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- EfficientNet is a light-weight model proposed by google, which consists of MBConv, and takes advantage of squeeze-and-excitation operation. This module is based on EfficientNetB2, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install efficientnetb2_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run efficientnetb2_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="efficientnetb2_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m efficientnetb2_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/efficientnetb2_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
* 1.1.0
Improve the prediction performance and users' experience
- ```shell
$ hub install efficientnetb2_imagenet==1.1.0
```
# efficientnetb3_imagenet
|Module Name|efficientnetb3_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|EfficientNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|51MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- EfficientNet is a light-weight model proposed by google, which consists of MBConv, and takes advantage of squeeze-and-excitation operation. This module is based on EfficientNetB3, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install efficientnetb3_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run efficientnetb3_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="efficientnetb3_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m efficientnetb3_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/efficientnetb3_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
* 1.1.0
Improve the prediction performance and users' experience
- ```shell
$ hub install efficientnetb3_imagenet==1.1.0
```
# efficientnetb4_imagenet
|Module Name|efficientnetb4_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|EfficientNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|77MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- EfficientNet is a light-weight model proposed by google, which consists of MBConv, and takes advantage of squeeze-and-excitation operation. This module is based on EfficientNetB4, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install efficientnetb4_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run efficientnetb4_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="efficientnetb4_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m efficientnetb4_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/efficientnetb4_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
* 1.1.0
Improve the prediction performance and users' experience
- ```shell
$ hub install efficientnetb4_imagenet==1.1.0
```
# efficientnetb5_imagenet
|Module Name|efficientnetb5_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|EfficientNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|121MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- EfficientNet is a light-weight model proposed by google, which consists of MBConv, and takes advantage of squeeze-and-excitation operation. This module is based on EfficientNetB5, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install efficientnetb5_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run efficientnetb5_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="efficientnetb5_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m efficientnetb5_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/efficientnetb5_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
* 1.1.0
Improve the prediction performance and users' experience
- ```shell
$ hub install efficientnetb5_imagenet==1.1.0
```
# efficientnetb6_imagenet
|Module Name|efficientnetb6_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|EfficientNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|170MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- EfficientNet is a light-weight model proposed by google, which consists of MBConv, and takes advantage of squeeze-and-excitation operation. This module is based on EfficientNetB6, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install efficientnetb6_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run efficientnetb6_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="efficientnetb6_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m efficientnetb6_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/efficientnetb6_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
* 1.1.0
Improve the prediction performance and users' experience
- ```shell
$ hub install efficientnetb6_imagenet==1.1.0
```
# efficientnetb7_imagenet
|Module Name|efficientnetb7_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|EfficientNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|260MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- EfficientNet is a light-weight model proposed by google, which consists of MBConv, and takes advantage of squeeze-and-excitation operation. This module is based on EfficientNetB7, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install efficientnetb7_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run efficientnetb7_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="efficientnetb7_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m efficientnetb7_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/efficientnetb7_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
* 1.1.0
Improve the prediction performance and users' experience
- ```shell
$ hub install efficientnetb7_imagenet==1.1.0
```
# fix_resnext101_32x48d_wsl_imagenet
|Module Name|fix_resnext101_32x48d_wsl_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|ResNeXt|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|3.1GB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数.该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install fix_resnext101_32x48d_wsl_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run fix_resnext101_32x48d_wsl_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="fix_resnext101_32x48d_wsl_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m fix_resnext101_32x48d_wsl_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/fix_resnext101_32x48d_wsl_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install fix_resnext101_32x48d_wsl_imagenet==1.0.0
```
# food_classification
|Module Name|food_classification|
| :--- | :---: |
|Category|image classification|
|Network|ResNet50_vd_ssld|
|Dataset|美食Dataset|
|Fine-tuning supported or not|No|
|Module Size|91MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- 美食分类(food_classification),该模型可识别苹果派,小排骨,烤面包,牛肉馅饼,牛肉鞑靼.该PaddleHub Module支持API预测及命令行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 2.0.0
- paddlehub >= 2.0.0 | [How to install PaddleHub]()
- paddlex >= 1.3.7
- ### 2、Installation
- ```shell
$ hub install food_classification
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run food_classification --input_path /PATH/TO/IMAGE
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="food_classification")
images = [cv2.imread('/PATH/TO/IMAGE')]
results = classifier.predict(images=images)
for result in results:
print(result)
```
- ### 3、API
- ```python
def predict(images)
```
- classification API.
- **Parameters**
- images:list类型,待检测的图像.
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
- category_id (int): 类别的id;
- category(str): 类别;
- score(float): 准确率
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install food_classification==1.0.0
```
# googlenet_imagenet
|Module Name|googlenet_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|GoogleNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|28MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- GoogleNet是图像分类中的经典模型.由Christian Szegedy等人在2014年提出,并获得了2014年ILSVRC竞赛冠军.该PaddleHub Module结构为GoogleNet,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install googlenet_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run googlenet_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="googlenet_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install googlenet_imagenet==1.0.0
```
# inception_v4_imagenet
|Module Name|inception_v4_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|Inception_V4|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|167MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- Inception 结构最初由 GoogLeNet 引入,因此 GoogLeNet 也被称为 Inception-v1,通过在 Inception-v1 的基础上引入Batch Normalization、分解、残差连接等技术,设计出了Inception-v4.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install inception_v4_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run inception_v4_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="inception_v4_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install inception_v4_imagenet==1.0.0
```
# marine_biometrics
|Module Name|marine_biometrics|
| :--- | :---: |
|Category|image classification|
|Network|ResNet50_vd_ssld|
|Dataset|Fish4Knowledge|
|Fine-tuning supported or not|No|
|Module Size|84MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- 海洋生物识别(marine_biometrics),该模型可准确识别鱼的种类.该PaddleHub Module支持API预测及命令行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 2.0.0
- paddlehub >= 2.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install marine_biometrics
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run marine_biometrics --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="marine_biometrics")
images = [cv2.imread('/PATH/TO/IMAGE')]
results = classifier.predict(images=images)
for result in results:
print(result)
```
- ### 3、API
- ```python
def predict(images)
```
- classification API.
- **Parameters**
- images:list类型,待检测的图像.
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install marine_biometrics==1.0.0
```
# mobilenet_v2_animals
|Module Name|mobilenet_v2_animals|
| :--- | :---: |
|Category|image classification|
|Network|MobileNet_v2|
|Dataset|百度自建动物Dataset|
|Fine-tuning supported or not|No|
|Module Size|50MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- MobileNet V2 是一个轻量化的卷积神经网络,它在 MobileNet 的基础上,做了 Inverted Residuals 和 Linear bottlenecks 这两大改进.该 PaddleHub Module 是在百度自建动物数据集上训练得到的,可用于图像分类和特征提取,当前已支持7978种动物的分类识别.模型的详情可参考[论文](https://arxiv.org/pdf/1801.04381.pdf).
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install mobilenet_v2_animals
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run mobilenet_v2_animals --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="mobilenet_v2_animals")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m mobilenet_v2_animals
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/mobilenet_v2_animals"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install mobilenet_v2_animals==1.0.0
```
# mobilenet_v2_dishes
|Module Name|mobilenet_v2_dishes|
| :--- | :---: |
|Category|image classification|
|Network|MobileNet_v2|
|Dataset|百度自建菜品Dataset|
|Fine-tuning supported or not|No|
|Module Size|52MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- MobileNet V2 是一个轻量化的卷积神经网络,它在 MobileNet 的基础上,做了 Inverted Residuals 和 Linear bottlenecks 这两大改进.该 PaddleHub Module 是在百度自建菜品数据集上训练得到的,可用于图像分类和特征提取,当前已支持8416种菜品的分类识别.
<p align="center">
<img src="http://bj.bcebos.com/ibox-thumbnail98/e7b22762cf42ab0e1e1fab6b8720938b?authorization=bce-auth-v1%2Ffbe74140929444858491fbf2b6bc0935%2F2020-04-08T11%3A49%3A16Z%2F1800%2F%2Faf385f56da3c8ee1298588939d93533a72203c079ae1187affa2da555b9898ea" width = "800" hspace='10'/> <br />
</p>
- 更多详情参考:[MobileNetV2: Inverted Residuals and Linear Bottlenecks](https://arxiv.org/pdf/1801.04381.pdf)
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install mobilenet_v2_dishes
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run mobilenet_v2_dishes --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="mobilenet_v2_dishes")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m mobilenet_v2_dishes
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/mobilenet_v2_dishes"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install mobilenet_v2_dishes==1.0.0
```
# mobilenet_v2_imagenet
|Module Name|mobilenet_v2_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|Mobilenet_v2|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|15MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- MobileNet V2是Mark Sandler, Andrew Howard等人在2018年提出的一个图像分类模型,该系列模型(MobileNet)是为移动和嵌入式设备提出的高效模型,在模型Parameters较少的情况下仍然保持了较高的分类准确率.该PaddleHub Module基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install mobilenet_v2_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run mobilenet_v2_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="mobilenet_v2_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
* 1.0.1
Fix the problem of encoding in python2
- ```shell
$ hub install mobilenet_v2_imagenet==1.0.1
```
# mobilenet_v2_imagenet_ssld
|Module Name|mobilenet_v2_imagenet_ssld|
| :--- | :---: |
|Category|image classification|
|Network|Mobilenet_v2|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|15MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- MobileNet V2是Mark Sandler, Andrew Howard等人在2018年提出的一个图像分类模型,该系列模型(MobileNet)是为移动和嵌入式设备提出的高效模型,在模型Parameters较少的情况下仍然保持了较高的分类准确率.该PaddleHub Module基于ImageNet-2012数据集并采用PaddleClas提供的SSLD蒸馏方法训练得到,接受输入图片大小为224 x 224 x 3,支持finetune,也可以直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install mobilenet_v2_imagenet_ssld
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run mobilenet_v2_imagenet_ssld --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="mobilenet_v2_imagenet_ssld")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m mobilenet_v2_imagenet_ssld
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/mobilenet_v2_imagenet_ssld"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install mobilenet_v2_imagenet_ssld==1.0.0
```
# mobilenet_v3_large_imagenet_ssld
|Module Name|mobilenet_v3_large_imagenet_ssld|
| :--- | :---: |
|Category|image classification|
|Network|Mobilenet_v3_large|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|23MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- MobileNetV3是Google在2019年发布的新模型,作者通过结合NAS与NetAdapt进行搜索得到该网络结构,提供了Large和Small两个版本,分别适用于对资源不同要求的情况.对比于MobileNetV2,新的模型在速度和精度方面均有提升.该PaddleHubModule的模型结构为MobileNetV3 Large,基于ImageNet-2012数据集并采用PaddleClas提供的SSLD蒸馏方法训练得到,接受输入图片大小为224 x 224 x 3,支持finetune,也可以直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install mobilenet_v3_large_imagenet_ssld
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run mobilenet_v3_large_imagenet_ssld --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="mobilenet_v3_large_imagenet_ssld")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m mobilenet_v3_large_imagenet_ssld
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/mobilenet_v3_large_imagenet_ssld"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install mobilenet_v3_large_imagenet_ssld==1.0.0
```
# mobilenet_v3_small_imagenet_ssld
|Module Name|mobilenet_v3_small_imagenet_ssld|
| :--- | :---: |
|Category|image classification|
|Network|Mobilenet_v3_Small|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|13MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- MobileNetV3是Google在2019年发布的新模型,作者通过结合NAS与NetAdapt进行搜索得到该网络结构,提供了Large和Small两个版本,分别适用于对资源不同要求的情况.对比于MobileNetV2,新的模型在速度和精度方面均有提升.该PaddleHubModule的模型结构为MobileNetV3 Small,基于ImageNet-2012数据集并采用PaddleClas提供的SSLD蒸馏方法训练得到,接受输入图片大小为224 x 224 x 3,支持finetune,也可以直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install mobilenet_v3_small_imagenet_ssld
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run mobilenet_v3_small_imagenet_ssld --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="mobilenet_v3_small_imagenet_ssld")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m mobilenet_v3_small_imagenet_ssld
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/mobilenet_v3_small_imagenet_ssld"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install mobilenet_v3_small_imagenet_ssld==1.0.0
```
# nasnet_imagenet
|Module Name|nasnet_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|NASNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|345MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- NASNet是Google通过AutoML自动训练出来的图像分类模型.该PaddleHub Module基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install nasnet_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run nasnet_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="nasnet_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
* 1.0.1
Fix the problem of encoding in python2
- ```shell
$ hub install nasnet_imagenet==1.0.1
```
# pnasnet_imagenet
|Module Name|pnasnet_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|PNASNet|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|333MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- PNASNet是Google通过AutoML自动训练出来的图像分类模型.该PaddleHub Module基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install pnasnet_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run pnasnet_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="pnasnet_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
* 1.0.1
Fix the problem of encoding in python2
- ```shell
$ hub install pnasnet_imagenet==1.0.1
```
# res2net101_vd_26w_4s_imagenet
|Module Name|res2net101_vd_26w_4s_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|Res2Net|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|179MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- Res2Net是2019年提出的一种全新的对ResNet的改进方案,该方案可以和现有其他优秀模块轻松整合,在不增加计算负载量的情况下,在ImageNet、CIFAR-100等数据集上的测试性能超过了ResNet.Res2Net结构简单,性能优越,进一步探索了CNN在更细粒度级别的多尺度表示能力. 该 PaddleHub Module 使用 ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install res2net101_vd_26w_4s_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run res2net101_vd_26w_4s_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="res2net101_vd_26w_4s_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m res2net101_vd_26w_4s_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/res2net101_vd_26w_4s_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install res2net101_vd_26w_4s_imagenet==1.0.0
```
# resnet18_vd_imagenet
|Module Name|resnet18_vd_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|ResNet_vd|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|46MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNet系列模型是图像分类领域的重要模型之一,模型中提出的残差单元有效地解决了深度网络训练困难的问题,通过增加模型的深度提升了模型的准确率,ResNet-vd 其实就是 ResNet-D,是ResNet 原始结构的变种.该PaddleHub Module结构为ResNet_vd,基于ImageNet-2012数据集训练得到,接受输入图片大小为224 x 224 x 3,支持finetune,也可以直接通过命令行或者Python接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnet18_vd_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run resnet18_vd_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnet18_vd_imagenet")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m resnet18_vd_imagenet
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/resnet18_vd_imagenet"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install resnet18_vd_imagenet==1.0.0
```
# resnet50_vd_10w
|Module Name|resnet50_vd_10w|
| :--- | :---: |
|Category|image classification|
|Network|ResNet_vd|
|Dataset|百度自建Dataset|
|Fine-tuning supported or not|No|
|Module Size|92MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNet系列模型是图像分类领域的重要模型之一,模型中提出的残差单元有效地解决了深度网络训练困难的问题,通过增加模型的深度提升了模型的准确率,ResNet-vd 其实就是 ResNet-D,是ResNet 原始结构的变种.该PaddleHub Module结构为ResNet_vd,使用百度自研的基于10万种类别、4千多万的有标签数据进行训练,接受输入图片大小为224 x 224 x 3,支持finetune.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnet50_vd_10w
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnet50_vd_10w")
input_dict, output_dict, program = classifier.context(trainable=True)
```
- ### 2、API
- ```python
def context(trainable=True, pretrained=True)
```
- **Parameters**
- trainable (bool): 计算图的Parameters是否为可训练的;<br/>
- pretrained (bool): 是否加载默认的预训练模型.
- **Return**
- inputs (dict): 计算图的输入,key 为 'image', value 为图片的张量;<br/>
- outputs (dict): 计算图的输出,key 为 'classification' 和 'feature_map',其相应的值为:
- classification (paddle.fluid.framework.Variable): 分类结果,也就是全连接层的输出;
- feature\_map (paddle.fluid.framework.Variable): 特征匹配,全连接层前面的那个张量.
- context\_prog(fluid.Program): 计算图,用于迁移学习.
- ```python
def save_inference_model(dirname,
model_filename=None,
params_filename=None,
combined=True)
```
- **Parameters**
- dirname: 存在模型的目录名称;<br/>
- model_filename: 模型文件名称,默认为\_\_model\_\_; <br/>
- params_filename: Parameters文件名称,默认为\_\_params\_\_(仅当`combined`为True时生效); <br/>
- combined: 是否将Parameters保存到统一的一个文件中.
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install resnet50_vd_10w==1.0.0
```
# resnet50_vd_dishes
|Module Name|resnet50_vd_dishes|
| :--- | :---: |
|Category|image classification|
|Network|ResNet50_vd|
|Dataset|百度自建菜品Dataset|
|Fine-tuning supported or not|No|
|Module Size|158MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNet-vd是ResNet原始结构的变种,可用于图像分类和特征提取.该 PaddleHub Module 采用百度自建菜品数据集训练得到,支持8416种菜品的分类识别.
<p align="center">
<img src="http://bj.bcebos.com/ibox-thumbnail98/77fa9b7003e4665867855b2b65216519?authorization=bce-auth-v1%2Ffbe74140929444858491fbf2b6bc0935%2F2020-04-08T11%3A05%3A10Z%2F1800%2F%2F1df0ecb4a52adefeae240c9e2189e8032560333e399b3187ef1a76e4ffa5f19f" width = "800" hspace='10'/> <br />
</p>
- 更多详情参考:[Bag of Tricks for Image Classification with Convolutional Neural Networks](https://arxiv.org/pdf/1812.01187.pdf)
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnet50_vd_dishes
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run resnet50_vd_dishes --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnet50_vd_dishes")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m resnet50_vd_dishes
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/resnet50_vd_dishes"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install resnet50_vd_dishes==1.0.0
```
# resnet50_vd_wildanimals
|Module Name|resnet50_vd_wildanimals|
| :--- | :---: |
|Category|image classification|
|Network|ResNet_vd|
|Dataset|IFAW 自建野生动物Dataset|
|Fine-tuning supported or not|No|
|Module Size|92MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNet-vd 其实就是 ResNet-D,是ResNet 原始结构的变种,可用于图像分类和特征提取.该 PaddleHub Module 采用百度自建野生动物数据集训练得到,支持'象牙制品','象牙', '大象', '虎皮', '老虎', '虎牙/虎爪/虎骨', '穿山甲甲片', '穿山甲', '穿山甲爪子', '其他' 这十个标签的识别.模型的详情可参考[论文](https://arxiv.org/pdf/1812.01187.pdf).
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.2
- paddlehub >= 1.6.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnet50_vd_wildanimals
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run resnet50_vd_wildanimals --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnet50_vd_wildanimals")
result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')])
# or
# result = classifier.classification(paths=['/PATH/TO/IMAGE'])
```
- ### 3、API
- ```python
def classification(images=None,
paths=None,
batch_size=1,
use_gpu=False,
top_k=1):
```
- classification API.
- **Parameters**
- images (list\[numpy.ndarray\]): image data, ndarray.shape is in the format [H, W, C], BGR;
- paths (list[str]): image path;
- batch_size (int): the size of batch;
- use_gpu (bool): use GPU or not; **set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU**
- top\_k (int): return the first k results
- **Return**
- res (list\[dict\]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Server Deployment
- PaddleHub Serving can deploy an online service of image classification.
- ### Step 1: Start PaddleHub Serving
- Run the startup command:
- ```shell
$ hub serving start -m resnet50_vd_wildanimals
```
- The servitization API is now deployed and the default port number is 8866.
- **NOTE:** If GPU is used for prediction, set CUDA_VISIBLE_DEVICES environment variable before the service, otherwise it need not be set.
- ### Step 2: Send a predictive request
- With a configured server, use the following lines of code to send the prediction request and obtain the result
- ```python
import requests
import json
import cv2
import base64
def cv2_to_base64(image):
data = cv2.imencode('.jpg', image)[1]
return base64.b64encode(data.tostring()).decode('utf8')
# Send an HTTP request
data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/resnet50_vd_wildanimals"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# print prediction results
print(r.json()["results"])
```
## V.Release Note
* 1.0.0
First release
- ```shell
$ hub install resnet50_vd_wildanimals==1.0.0
```
# resnet_v2_101_imagenet
|Module Name|resnet_v2_101_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|ResNet V2 101|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|173MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNet proposed a residual unit to solve the problem of training an extremely deep network, and improved the prediction accuracy of models. This module is based on ResNet101, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnet_v2_101_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run resnet_v2_101_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnet_v2_101_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
* 1.0.1
Fix the problem of encoding in python2
- ```shell
$ hub install resnet_v2_101_imagenet==1.0.1
```
# resnet_v2_152_imagenet
|Module Name|resnet_v2_152_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|ResNet V2|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|234MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNet proposed a residual unit to solve the problem of training an extremely deep network, and improved the prediction accuracy of models. This module is based on ResNet152, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnet_v2_152_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run resnet_v2_152_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnet_v2_152_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
* 1.0.1
Fix the problem of encoding in python2
- ```shell
$ hub install resnet_v2_152_imagenet==1.0.1
```
# resnet_v2_18_imagenet
|Module Name|resnet_v2_18_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|ResNet V2|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|46MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNet proposed a residual unit to solve the problem of training an extremely deep network, and improved the prediction accuracy of models. This module is based on ResNet18, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnet_v2_18_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run resnet_v2_18_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnet_v2_18_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install resnet_v2_18_imagenet==1.0.0
```
# resnet_v2_34_imagenet
|Module Name|resnet_v2_34_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|ResNet V2|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|85MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNet proposed a residual unit to solve the problem of training an extremely deep network, and improved the prediction accuracy of models. This module is based on ResNet34, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnet_v2_34_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run resnet_v2_34_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnet_v2_34_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install resnet_v2_34_imagenet==1.0.0
```
# resnet_v2_50_imagenet
|Module Name|resnet_v2_50_imagenet|
| :--- | :---: |
|Category|image classification|
|Network|ResNet V2|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|99MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- ResNet proposed a residual unit to solve the problem of training an extremely deep network, and improved the prediction accuracy of models. This module is based on ResNet50, trained on ImageNet-2012 dataset, and can predict an image of size 224*224*3.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.4.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnet_v2_50_imagenet
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run resnet_v2_50_imagenet --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnet_v2_50_imagenet")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
* 1.0.1
Fix the problem of encoding in python2
- ```shell
$ hub install resnet_v2_50_imagenet==1.0.1
```
# resnext101_32x16d_wsl
|Module Name|resnext101_32x16d_wsl|
| :--- | :---: |
|Category|image classification|
|Network|ResNeXt_wsl|
|Dataset|ImageNet-2012|
|Fine-tuning supported or not|No|
|Module Size|744MB|
|Latest update date|-|
|Data indicators|-|
## I.Basic Information
- ### Module Introduction
- 由于人工标注的数据集在规模上已经接近其函数极限,Facebook 的研发人员采用了一种独特的迁移学习研究,通过使用 hashtag 作为标注,在包含数十亿张社交媒体图片的数据集上进行训练,这为大规模训练转向弱监督学习(Weakly Supervised Learning) 取得了重大突破.在 ImageNet 图像识别基准上,ResNeXt101_32x16d_wsl 的 Top-1 达到了 84.24% 的准确率.该 PaddleHub Module结构为 ResNeXt101_32x16d_wsl,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测.
## II.Installation
- ### 1、Environmental Dependence
- paddlepaddle >= 1.6.0
- paddlehub >= 1.0.0 | [How to install PaddleHub]()
- ### 2、Installation
- ```shell
$ hub install resnext101_32x16d_wsl
```
- In case of any problems during installation, please refer to: [Windows_Quickstart]() | [Linux_Quickstart]() | [Mac_Quickstart]()
## III.Module API Prediction
- ### 1、Command line Prediction
- ```shell
$ hub run resnext101_32x16d_wsl --input_path "/PATH/TO/IMAGE"
```
- If you want to call the Hub module through the command line, please refer to: [PaddleHub Command Line Instruction](../../../../docs/docs_ch/tutorial/cmd_usage.rst)
- ### 2、预测Prediction Code Example
- ```python
import paddlehub as hub
import cv2
classifier = hub.Module(name="resnext101_32x16d_wsl")
test_img_path = "/PATH/TO/IMAGE"
input_dict = {"image": [test_img_path]}
result = classifier.classification(data=input_dict)
```
- ### 3、API
- ```python
def classification(data)
```
- classification API.
- **Parameters**
- data (dict): key is "image", value is a list of image paths
- **Return**
- result(list[dict]): classication results, each element in the list is dict, key is the label name, and value is the corresponding probability
## IV.Release Note
* 1.0.0
First release
- ```shell
$ hub install resnext101_32x16d_wsl==1.0.0
```
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册