From be73bfb6c8361c53439bfb7b1b39d0eff3265a00 Mon Sep 17 00:00:00 2001 From: chenjian Date: Fri, 12 Nov 2021 16:14:09 +0800 Subject: [PATCH] Update image classification docs (#1652) --- .../animegan_v2_paprika_54/README.md | 25 +-- .../DriverStatusRecognition/README.md | 155 +++++++------ .../DriverStatusRecognition/requirements.txt | 2 + .../SnakeIdentification/README.md | 154 +++++++------ .../SnakeIdentification/requirements.txt | 1 + .../classification/alexnet_imagenet/README.md | 84 ++++++++ .../darknet53_imagenet/README.md | 84 ++++++++ .../densenet121_imagenet/README.md | 84 ++++++++ .../densenet161_imagenet/README.md | 84 ++++++++ .../densenet169_imagenet/README.md | 84 ++++++++ .../densenet201_imagenet/README.md | 84 ++++++++ .../densenet264_imagenet/README.md | 84 ++++++++ .../classification/dpn107_imagenet/README.md | 85 ++++++++ .../classification/dpn131_imagenet/README.md | 85 ++++++++ .../classification/dpn68_imagenet/README.md | 85 ++++++++ .../classification/dpn92_imagenet/README.md | 85 ++++++++ .../classification/dpn98_imagenet/README.md | 86 ++++++++ .../efficientnetb0_imagenet/README.md | 137 ++++++++++++ .../efficientnetb0_small_imagenet/README.md | 136 ++++++++++++ .../efficientnetb1_imagenet/README.md | 136 ++++++++++++ .../efficientnetb2_imagenet/README.md | 136 ++++++++++++ .../efficientnetb3_imagenet/README.md | 136 ++++++++++++ .../efficientnetb4_imagenet/README.md | 137 ++++++++++++ .../efficientnetb5_imagenet/README.md | 137 ++++++++++++ .../efficientnetb6_imagenet/README.md | 136 ++++++++++++ .../efficientnetb7_imagenet/README.md | 137 ++++++++++++ .../README.md | 191 ++++++++-------- .../food_classification/README.md | 174 +++++++-------- .../food_classification/requirements.txt | 2 +- .../googlenet_imagenet/README.md | 84 ++++++++ .../inception_v4_imagenet/README.md | 84 ++++++++ .../marine_biometrics/README.md | 154 +++++++------ .../marine_biometrics/requirements.txt | 1 + .../mobilenet_v2_animals/README.md | 201 ++++++++--------- .../mobilenet_v2_dishes/README.md | 204 ++++++++---------- .../mobilenet_v2_imagenet/README.md | 88 ++++++++ .../mobilenet_v2_imagenet_ssld/README.md | 133 ++++++++++++ .../README.md | 135 ++++++++++++ .../README.md | 134 ++++++++++++ .../classification/nasnet_imagenet/README.md | 87 ++++++++ .../classification/pnasnet_imagenet/README.md | 87 ++++++++ .../res2net101_vd_26w_4s_imagenet/README.md | 191 ++++++++-------- .../resnet18_vd_imagenet/README.md | 136 ++++++++++++ .../classification/resnet50_vd_10w/README.md | 95 ++++++++ .../resnet50_vd_dishes/README.md | 203 ++++++++--------- .../resnet50_vd_wildanimals/README.md | 201 ++++++++--------- .../resnet_v2_101_imagenet/README.md | 86 ++++++++ .../resnet_v2_152_imagenet/README.md | 86 ++++++++ .../resnet_v2_18_imagenet/README.md | 84 ++++++++ .../resnet_v2_34_imagenet/README.md | 84 ++++++++ .../resnet_v2_50_imagenet/README.md | 86 ++++++++ .../resnext101_32x16d_wsl/README.md | 84 ++++++++ .../resnext101_32x32d_wsl/README.md | 84 ++++++++ .../resnext101_32x48d_wsl/README.md | 84 ++++++++ .../resnext101_32x4d_imagenet/README.md | 85 ++++++++ .../resnext101_32x8d_wsl/README.md | 84 ++++++++ .../resnext101_64x4d_imagenet/README.md | 84 ++++++++ .../resnext101_vd_32x4d_imagenet/README.md | 83 +++++++ .../resnext101_vd_64x4d_imagenet/README.md | 83 +++++++ .../resnext152_32x4d_imagenet/README.md | 85 ++++++++ .../resnext152_64x4d_imagenet/README.md | 84 ++++++++ .../resnext152_vd_64x4d_imagenet/README.md | 84 ++++++++ .../resnext50_32x4d_imagenet/README.md | 84 ++++++++ .../resnext50_64x4d_imagenet/README.md | 84 ++++++++ .../resnext50_vd_32x4d_imagenet/README.md | 84 ++++++++ .../resnext50_vd_64x4d_imagenet/README.md | 83 +++++++ .../se_resnet18_vd_imagenet/README.md | 2 +- .../se_resnext101_32x4d_imagenet/README.md | 84 ++++++++ .../se_resnext50_32x4d_imagenet/README.md | 84 ++++++++ .../shufflenet_v2_imagenet/README.md | 84 ++++++++ .../spinalnet_res101_gemstone/README.md | 81 +++++++ .../spinalnet_res50_gemstone/README.md | 81 +++++++ .../spinalnet_vgg16_gemstone/README.md | 81 +++++++ .../classification/vgg11_imagenet/README.md | 84 ++++++++ .../classification/vgg13_imagenet/README.md | 84 ++++++++ .../classification/vgg16_imagenet/README.md | 84 ++++++++ .../classification/vgg19_imagenet/README.md | 84 ++++++++ .../xception41_imagenet/README.md | 84 ++++++++ .../xception65_imagenet/README.md | 84 ++++++++ .../xception71_imagenet/README.md | 84 ++++++++ 80 files changed, 6983 insertions(+), 951 deletions(-) create mode 100644 modules/image/classification/DriverStatusRecognition/requirements.txt create mode 100644 modules/image/classification/SnakeIdentification/requirements.txt create mode 100644 modules/image/classification/alexnet_imagenet/README.md create mode 100644 modules/image/classification/darknet53_imagenet/README.md create mode 100644 modules/image/classification/densenet121_imagenet/README.md create mode 100644 modules/image/classification/densenet161_imagenet/README.md create mode 100644 modules/image/classification/densenet169_imagenet/README.md create mode 100644 modules/image/classification/densenet201_imagenet/README.md create mode 100644 modules/image/classification/densenet264_imagenet/README.md create mode 100644 modules/image/classification/dpn107_imagenet/README.md create mode 100644 modules/image/classification/dpn131_imagenet/README.md create mode 100644 modules/image/classification/dpn68_imagenet/README.md create mode 100644 modules/image/classification/dpn92_imagenet/README.md create mode 100644 modules/image/classification/dpn98_imagenet/README.md create mode 100644 modules/image/classification/efficientnetb0_imagenet/README.md create mode 100644 modules/image/classification/efficientnetb0_small_imagenet/README.md create mode 100644 modules/image/classification/efficientnetb1_imagenet/README.md create mode 100644 modules/image/classification/efficientnetb2_imagenet/README.md create mode 100644 modules/image/classification/efficientnetb3_imagenet/README.md create mode 100644 modules/image/classification/efficientnetb4_imagenet/README.md create mode 100644 modules/image/classification/efficientnetb5_imagenet/README.md create mode 100644 modules/image/classification/efficientnetb6_imagenet/README.md create mode 100644 modules/image/classification/efficientnetb7_imagenet/README.md create mode 100644 modules/image/classification/googlenet_imagenet/README.md create mode 100644 modules/image/classification/inception_v4_imagenet/README.md create mode 100644 modules/image/classification/marine_biometrics/requirements.txt create mode 100644 modules/image/classification/mobilenet_v2_imagenet/README.md create mode 100644 modules/image/classification/mobilenet_v2_imagenet_ssld/README.md create mode 100644 modules/image/classification/mobilenet_v3_large_imagenet_ssld/README.md create mode 100644 modules/image/classification/mobilenet_v3_small_imagenet_ssld/README.md create mode 100644 modules/image/classification/nasnet_imagenet/README.md create mode 100644 modules/image/classification/pnasnet_imagenet/README.md create mode 100644 modules/image/classification/resnet18_vd_imagenet/README.md create mode 100644 modules/image/classification/resnet50_vd_10w/README.md create mode 100644 modules/image/classification/resnet_v2_101_imagenet/README.md create mode 100644 modules/image/classification/resnet_v2_152_imagenet/README.md create mode 100644 modules/image/classification/resnet_v2_18_imagenet/README.md create mode 100644 modules/image/classification/resnet_v2_34_imagenet/README.md create mode 100644 modules/image/classification/resnet_v2_50_imagenet/README.md create mode 100644 modules/image/classification/resnext101_32x16d_wsl/README.md create mode 100644 modules/image/classification/resnext101_32x32d_wsl/README.md create mode 100644 modules/image/classification/resnext101_32x48d_wsl/README.md create mode 100644 modules/image/classification/resnext101_32x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext101_32x8d_wsl/README.md create mode 100644 modules/image/classification/resnext101_64x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext101_vd_32x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext101_vd_64x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext152_32x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext152_64x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext152_vd_64x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext50_32x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext50_64x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext50_vd_32x4d_imagenet/README.md create mode 100644 modules/image/classification/resnext50_vd_64x4d_imagenet/README.md create mode 100644 modules/image/classification/se_resnext101_32x4d_imagenet/README.md create mode 100644 modules/image/classification/se_resnext50_32x4d_imagenet/README.md create mode 100644 modules/image/classification/shufflenet_v2_imagenet/README.md create mode 100644 modules/image/classification/spinalnet_res101_gemstone/README.md create mode 100644 modules/image/classification/spinalnet_res50_gemstone/README.md create mode 100644 modules/image/classification/spinalnet_vgg16_gemstone/README.md create mode 100644 modules/image/classification/vgg11_imagenet/README.md create mode 100644 modules/image/classification/vgg13_imagenet/README.md create mode 100644 modules/image/classification/vgg16_imagenet/README.md create mode 100644 modules/image/classification/vgg19_imagenet/README.md create mode 100644 modules/image/classification/xception41_imagenet/README.md create mode 100644 modules/image/classification/xception65_imagenet/README.md create mode 100644 modules/image/classification/xception71_imagenet/README.md diff --git a/modules/image/Image_gan/style_transfer/animegan_v2_paprika_54/README.md b/modules/image/Image_gan/style_transfer/animegan_v2_paprika_54/README.md index 6aac060d1..5dcf44fb7 100644 --- a/modules/image/Image_gan/style_transfer/animegan_v2_paprika_54/README.md +++ b/modules/image/Image_gan/style_transfer/animegan_v2_paprika_54/README.md @@ -4,10 +4,10 @@ | :--- | :---: | |类别|图像 - 图像生成| |网络|AnimeGAN| -|数据集|The Wind Rises| +|数据集|Paprika| |是否支持Fine-tuning|否| |模型大小|9.4MB| -|最新更新日期|2021-07-30| +|最新更新日期|2021-02-26| |数据指标|-| @@ -16,21 +16,20 @@ - ### 应用效果展示 - 样例结果示例:

- -
+ +
输入图像 -
- -
+
+ +
输出图像

- - ### 模型介绍 - - AnimeGAN V2 图像风格转换模型, 模型可将输入的图像转换成宫崎骏动漫风格,模型权重转换自[AnimeGAN V2官方开源项目](https://github.com/TachibanaYoshino/AnimeGAN)。 + - AnimeGAN V2 图像风格转换模型, 模型可将输入的图像转换成今敏红辣椒动漫风格,模型权重转换自[AnimeGAN V2官方开源项目](https://github.com/TachibanaYoshino/AnimeGANv2)。 ## 二、安装 @@ -81,12 +80,10 @@ - images (list\[numpy.ndarray\]): 图片数据,ndarray.shape 为 \[H, W, C\];
- paths (list\[str\]): 图片的路径;
- output\_dir (str): 图片的保存路径,默认设为 output;
- - visualization (bool): 是否将识别结果保存为图片文件;
+ - visualization (bool): 是否将结果保存为图片文件;
- min\_size (int): 输入图片的短边最小尺寸,默认设为 32;
- max\_size (int): 输入图片的短边最大尺寸,默认设为 1024。 - **NOTE:** paths和images两个参数选择其一进行提供数据 - - **返回** - res (list\[numpy.ndarray\]): 输出图像数据,ndarray.shape 为 \[H, W, C\] @@ -145,3 +142,7 @@ * 1.0.2 删除batch_size选项 + + - ```shell + $ hub install animegan_v2_paprika_54==1.0.2 + ``` \ No newline at end of file diff --git a/modules/image/classification/DriverStatusRecognition/README.md b/modules/image/classification/DriverStatusRecognition/README.md index 4de54de77..9183c607a 100644 --- a/modules/image/classification/DriverStatusRecognition/README.md +++ b/modules/image/classification/DriverStatusRecognition/README.md @@ -1,65 +1,90 @@ -DriverStatusRecognition -类别 图像 - 图像分类 -网络 MobileNetV3_small_ssld -数据集 分心司机检测数据集 - -# 模型概述 -驾驶员状态识别(DriverStatusRecognition),该模型可挖掘出人在疲劳状态下的表情特征,然后将这些定性的表情特征进行量化,提取出面部特征点及特征指标作为判断依据,再结合实验数据总结出基于这些参数的识别方法,最后输入获取到的状态数据进行识别和判断。该PaddleHub Module支持API预测及命令行预测。 - -# 选择模型版本进行安装 -$ hub install DriverStatusRecognition==1.0.0 - -# 在线体验 -[AI Studio快速体验](https://aistudio.baidu.com/aistudio/projectdetail/1649513) - -# 命令行预测示例 -$ hub run DriverStatusRecognition --image 1.png --use_gpu True - -# Module API说明 -## def predict(data) -驾驶员状态识别预测接口,输入一张图像,输出该图像上驾驶员的状态 -### 参数 -- data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 - -### 返回 -- result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 - -# 代码示例 - -## API调用 -~~~ -import cv2 -import paddlehub as hub - -module = hub.Module(directory='DriverStatusRecognition') # 一行代码实现模型调用 - -images = [cv2.imread('work/imgs/test/img_1622.jpg'), cv2.imread('work/imgs/test/img_14165.jpg'), cv2.imread('work/imgs/test/img_47183.jpg')] -results = module.predict(images=images) - -for result in results: - print(result) -~~~ - -## 命令行调用 -~~~ -$ hub run DriverStatusRecognition --image 1.png --use_gpu True -~~~ - -# 效果展示 - -## 原图 - - -## 输出结果 -~~~ -[{'category_id': 5, 'category': 'ch5', 'score': 0.47390476}] -[{'category_id': 2, 'category': 'ch2', 'score': 0.99997914}] -[{'category_id': 1, 'category': 'ch1', 'score': 0.99996376}] -~~~ - -# 贡献者 -郑博培、彭兆帅 - -# 依赖 -paddlepaddle >= 2.0.0
-paddlehub >= 2.0.0 +# DriverStatusRecognition + +|模型名称|DriverStatusRecognition| +| :--- | :---: | +|类别|图像-图像分类| +|网络|MobileNetV3_small_ssld| +|数据集|分心司机检测数据集| +|是否支持Fine-tuning|否| +|模型大小|6MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 驾驶员状态识别(DriverStatusRecognition),该模型可挖掘出人在疲劳状态下的表情特征,然后将这些定性的表情特征进行量化,提取出面部特征点及特征指标作为判断依据,再结合实验数据总结出基于这些参数的识别方法,最后输入获取到的状态数据进行识别和判断。该PaddleHub Module支持API预测及命令行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 2.0.0 + + - paddlehub >= 2.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + - paddlex >= 1.3.7 + + +- ### 2、安装 + + - ```shell + $ hub install DriverStatusRecognition + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +- ### 3、在线体验 + [AI Studio 快速体验](https://aistudio.baidu.com/aistudio/projectdetail/1649513) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run DriverStatusRecognition --input_path /PATH/TO/IMAGE + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - images:list类型,待检测的图像。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install DriverStatusRecognition==1.0.0 + ``` diff --git a/modules/image/classification/DriverStatusRecognition/requirements.txt b/modules/image/classification/DriverStatusRecognition/requirements.txt new file mode 100644 index 000000000..736e12bdd --- /dev/null +++ b/modules/image/classification/DriverStatusRecognition/requirements.txt @@ -0,0 +1,2 @@ +paddlex==1.3.7 +chardet diff --git a/modules/image/classification/SnakeIdentification/README.md b/modules/image/classification/SnakeIdentification/README.md index e39ea8de4..809aae6db 100644 --- a/modules/image/classification/SnakeIdentification/README.md +++ b/modules/image/classification/SnakeIdentification/README.md @@ -1,64 +1,90 @@ -SnakeIdentification -类别 图像 - 图像分类 -网络 ResNet50_vd_ssld -数据集 蛇种数据集 - -# 模型概述 -蛇种识别(SnakeIdentification),该模型可准确识别蛇的种类,并精准判断蛇的毒性。该PaddleHub Module支持API预测及命令行预测。 - -# 选择模型版本进行安装 -$ hub install SnakeIdentification==1.0.0 - -# 在线体验 -[AI Studio快速体验](https://aistudio.baidu.com/aistudio/projectdetail/1646951) - -# 命令行预测示例 -$ hub run SnakeIdentification --image 1.png --use_gpu True - -# Module API说明 -## def predict(data) -蛇种识别预测接口,输入一张图像,输出该图像上蛇的类别 -### 参数 -- data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 - -### 返回 -- result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 - -# 代码示例 - -## API调用 -~~~ -import cv2 -import paddlehub as hub - -module = hub.Module(name="SnakeIdentification") - -images = [cv2.imread('snake_data/class_1/2421.jpg')] - -# execute predict and print the result -results = module.predict(images=images) -for result in results: - print(result) -~~~ - -## 命令行调用 -~~~ -$ hub run SnakeIdentification --image 1.png --use_gpu True -~~~ - -# 效果展示 - -## 原图 - - -## 输出结果 -~~~ -[{'category_id': 0, 'category': '水蛇', 'score': 0.9999205}] -~~~ - -# 贡献者 -郑博培、彭兆帅 - -# 依赖 -paddlepaddle >= 2.0.0
-paddlehub >= 2.0.0 +# SnakeIdentification + +|模型名称|SnakeIdentification| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet50_vd_ssld| +|数据集|蛇种数据集| +|是否支持Fine-tuning|否| +|模型大小|84MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 蛇种识别(SnakeIdentification),该模型可准确识别蛇的种类,并精准判断蛇的毒性。该PaddleHub Module支持API预测及命令行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 2.0.0 + + - paddlehub >= 2.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + - paddlex >= 1.3.7 + + +- ### 2、安装 + + - ```shell + $ hub install SnakeIdentification + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +- ### 3、在线体验 + [AI Studio 快速体验](https://aistudio.baidu.com/aistudio/projectdetail/1646951) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run SnakeIdentification --input_path /PATH/TO/IMAGE + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - images:list类型,待检测的图像。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install SnakeIdentification==1.0.0 + ``` diff --git a/modules/image/classification/SnakeIdentification/requirements.txt b/modules/image/classification/SnakeIdentification/requirements.txt new file mode 100644 index 000000000..307c5de76 --- /dev/null +++ b/modules/image/classification/SnakeIdentification/requirements.txt @@ -0,0 +1 @@ +paddlex==1.3.7 diff --git a/modules/image/classification/alexnet_imagenet/README.md b/modules/image/classification/alexnet_imagenet/README.md new file mode 100644 index 000000000..50fe4c0b3 --- /dev/null +++ b/modules/image/classification/alexnet_imagenet/README.md @@ -0,0 +1,84 @@ +# alexnet_imagenet + +|模型名称|alexnet_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|AlexNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|234MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - AlexNet是图像分类中的经典模型。模型由Alex Krizhevsky于2012年提出,并在2012年ILSVRC比赛中夺得冠军。该PaddleHub Module结构为AlexNet,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install alexnet_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run alexnet_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install alexnet_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/darknet53_imagenet/README.md b/modules/image/classification/darknet53_imagenet/README.md new file mode 100644 index 000000000..161f43427 --- /dev/null +++ b/modules/image/classification/darknet53_imagenet/README.md @@ -0,0 +1,84 @@ +# darknet53_imagenet + +|模型名称|darknet53_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DarkNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|160MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DarkNet 是由 Joseph Redmon 提出的图像分类模型,并应用于Yolov3 中作为 Backbone 来完成特征提取。该网络采用连续的 3*3 和 1*1 卷积进行连接,并像ResNet 一样有ShortCut连接。该 PaddleHub Module 基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install darknet53_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run darknet53_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现文字识别模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install darknet53_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/densenet121_imagenet/README.md b/modules/image/classification/densenet121_imagenet/README.md new file mode 100644 index 000000000..548d5d983 --- /dev/null +++ b/modules/image/classification/densenet121_imagenet/README.md @@ -0,0 +1,84 @@ +# densenet121_imagenet + +|模型名称|densenet121_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DenseNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|34MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接。对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入。DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了参数量。该PaddleHub Module结构为 DenseNet121,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install densenet121_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run densenet121_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install densenet121_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/densenet161_imagenet/README.md b/modules/image/classification/densenet161_imagenet/README.md new file mode 100644 index 000000000..19c779407 --- /dev/null +++ b/modules/image/classification/densenet161_imagenet/README.md @@ -0,0 +1,84 @@ +# densenet161_imagenet + +|模型名称|densenet161_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DenseNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|114MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接。对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入。DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了参数量。该PaddleHub Module结构为 DenseNet161,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install densenet161_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run densenet161_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install densenet161_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/densenet169_imagenet/README.md b/modules/image/classification/densenet169_imagenet/README.md new file mode 100644 index 000000000..56a7bd4ea --- /dev/null +++ b/modules/image/classification/densenet169_imagenet/README.md @@ -0,0 +1,84 @@ +# densenet169_imagenet + +|模型名称|densenet169_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DenseNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|59MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接。对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入。DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了参数量。该PaddleHub Module结构为 DenseNet169,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install densenet169_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run densenet169_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install densenet169_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/densenet201_imagenet/README.md b/modules/image/classification/densenet201_imagenet/README.md new file mode 100644 index 000000000..702886c85 --- /dev/null +++ b/modules/image/classification/densenet201_imagenet/README.md @@ -0,0 +1,84 @@ +# densenet201_imagenet + +|模型名称|densenet201_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DenseNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|82MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接。对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入。DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了参数量。该PaddleHub Module结构为 DenseNet201,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install densenet201_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run densenet201_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install densenet201_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/densenet264_imagenet/README.md b/modules/image/classification/densenet264_imagenet/README.md new file mode 100644 index 000000000..4a35aea83 --- /dev/null +++ b/modules/image/classification/densenet264_imagenet/README.md @@ -0,0 +1,84 @@ +# densenet264_imagenet + +|模型名称|densenet264_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DenseNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|135MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DenseNet 是 CVPR 2017 最佳论文的模型,DenseNet 以前馈方式将每一层与其他层连接,从而 L 层网络就有 L(L+1)/2 个直接连接。对于每一层,其输入是之前的所有层的特征图,而自己的特征图作为之后所有层的输入。DenseNet 缓解了梯度消失问题,加强特征传播,促进了特征重用,并大幅减少了参数量。该PaddleHub Module结构为 DenseNet264,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install densenet264_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run densenet264_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install densenet264_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/dpn107_imagenet/README.md b/modules/image/classification/dpn107_imagenet/README.md new file mode 100644 index 000000000..e97226f52 --- /dev/null +++ b/modules/image/classification/dpn107_imagenet/README.md @@ -0,0 +1,85 @@ +# dpn107_imagenet + +|模型名称|dpn107_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DPN| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|335MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想。该PaddleHub Module结构为 DPN107,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install dpn107_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run dpn107_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install dpn107_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/dpn131_imagenet/README.md b/modules/image/classification/dpn131_imagenet/README.md new file mode 100644 index 000000000..1afd847c2 --- /dev/null +++ b/modules/image/classification/dpn131_imagenet/README.md @@ -0,0 +1,85 @@ +# dpn131_imagenet + +|模型名称|dpn131_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DPN| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|306MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想。该PaddleHub Module结构为 DPN98,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install dpn131_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run dpn131_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install dpn131_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/dpn68_imagenet/README.md b/modules/image/classification/dpn68_imagenet/README.md new file mode 100644 index 000000000..725181619 --- /dev/null +++ b/modules/image/classification/dpn68_imagenet/README.md @@ -0,0 +1,85 @@ +# dpn68_imagenet + +|模型名称|dpn68_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DPN| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|50MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想。该PaddleHub Module结构为 DPN68,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install dpn68_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run dpn68_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install dpn68_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/dpn92_imagenet/README.md b/modules/image/classification/dpn92_imagenet/README.md new file mode 100644 index 000000000..69024027d --- /dev/null +++ b/modules/image/classification/dpn92_imagenet/README.md @@ -0,0 +1,85 @@ +# dpn92_imagenet + +|模型名称|dpn92_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DPN| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|146MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想。该PaddleHub Module结构为 DPN92,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install dpn92_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run dpn92_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install dpn92_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/dpn98_imagenet/README.md b/modules/image/classification/dpn98_imagenet/README.md new file mode 100644 index 000000000..a418583c6 --- /dev/null +++ b/modules/image/classification/dpn98_imagenet/README.md @@ -0,0 +1,86 @@ +# dpn98_imagenet + +|模型名称|dpn98_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|DPN| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|238MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - DPN(Dual Path Networks) 是 ImageNet 2017 目标定位冠军的图像分类模型,融合了 ResNet 和 DenseNet 的核心思想。该PaddleHub Module结构为 DPN98,基于ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install dpn98_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run dpn98_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install dpn98_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/efficientnetb0_imagenet/README.md b/modules/image/classification/efficientnetb0_imagenet/README.md new file mode 100644 index 000000000..a1013ab01 --- /dev/null +++ b/modules/image/classification/efficientnetb0_imagenet/README.md @@ -0,0 +1,137 @@ +# efficientnetb0_imagenet + +|模型名称|efficientnetb0_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|EfficientNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|22MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - EfficientNet 是谷歌的开源新模型,是一个轻量级网络,它的主干网络由 MBConv 构成,同时采取了 squeeze-and-excitation 操作对网络结构进行优化。该 PaddleHub Module结构为 EfficientNetB0,基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install efficientnetb0_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run efficientnetb0_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m efficientnetb0_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.1.0 + + 提升预测性能以及易用性 + - ```shell + $ hub install efficientnetb0_imagenet==1.1.0 + ``` diff --git a/modules/image/classification/efficientnetb0_small_imagenet/README.md b/modules/image/classification/efficientnetb0_small_imagenet/README.md new file mode 100644 index 000000000..be464cc8c --- /dev/null +++ b/modules/image/classification/efficientnetb0_small_imagenet/README.md @@ -0,0 +1,136 @@ +# efficientnetb0_small_imagenet + +|模型名称|efficientnetb0_small_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|EfficientNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|20MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - EfficientNet 是谷歌的开源新模型,是一个轻量级网络,它的主干网络由 MBConv 构成,同时采取了 squeeze-and-excitation 操作对网络结构进行优化。该 PaddleHub Module结构为 EfficientNetB0,基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install efficientnetb0_small_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run efficientnetb0_small_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m efficientnetb0_small_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install efficientnetb0_small_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/efficientnetb1_imagenet/README.md b/modules/image/classification/efficientnetb1_imagenet/README.md new file mode 100644 index 000000000..fe5981ece --- /dev/null +++ b/modules/image/classification/efficientnetb1_imagenet/README.md @@ -0,0 +1,136 @@ +# efficientnetb1_imagenet + +|模型名称|efficientnetb1_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|EfficientNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|33MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - EfficientNet 是谷歌的开源新模型,是一个轻量级网络,它的主干网络由 MBConv 构成,同时采取了 squeeze-and-excitation 操作对网络结构进行优化。该 PaddleHub Module结构为 EfficientNetB1,基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install efficientnetb1_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run efficientnetb1_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m efficientnetb1_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.1.0 + + 提升预测性能以及易用性 + - ```shell + $ hub install efficientnetb1_imagenet==1.1.0 + ``` diff --git a/modules/image/classification/efficientnetb2_imagenet/README.md b/modules/image/classification/efficientnetb2_imagenet/README.md new file mode 100644 index 000000000..3972b35e1 --- /dev/null +++ b/modules/image/classification/efficientnetb2_imagenet/README.md @@ -0,0 +1,136 @@ +# efficientnetb2_imagenet + +|模型名称|efficientnetb2_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|EfficientNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|38MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - EfficientNet 是谷歌的开源新模型,是一个轻量级网络,它的主干网络由 MBConv 构成,同时采取了 squeeze-and-excitation 操作对网络结构进行优化。该 PaddleHub Module结构为 EfficientNetB2,基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install efficientnetb2_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run efficientnetb2_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m efficientnetb2_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.1.0 + + 提升预测性能以及易用性 + - ```shell + $ hub install efficientnetb2_imagenet==1.1.0 + ``` diff --git a/modules/image/classification/efficientnetb3_imagenet/README.md b/modules/image/classification/efficientnetb3_imagenet/README.md new file mode 100644 index 000000000..3bb627392 --- /dev/null +++ b/modules/image/classification/efficientnetb3_imagenet/README.md @@ -0,0 +1,136 @@ +# efficientnetb3_imagenet + +|模型名称|efficientnetb3_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|EfficientNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|51MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - EfficientNet 是谷歌的开源新模型,是一个轻量级网络,它的主干网络由 MBConv 构成,同时采取了 squeeze-and-excitation 操作对网络结构进行优化。该 PaddleHub Module结构为 EfficientNetB3,基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install efficientnetb3_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run efficientnetb3_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m efficientnetb3_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.1.0 + + 提升预测性能以及易用性 + - ```shell + $ hub install efficientnetb3_imagenet==1.1.0 + ``` diff --git a/modules/image/classification/efficientnetb4_imagenet/README.md b/modules/image/classification/efficientnetb4_imagenet/README.md new file mode 100644 index 000000000..1a7d0e9ba --- /dev/null +++ b/modules/image/classification/efficientnetb4_imagenet/README.md @@ -0,0 +1,137 @@ +# efficientnetb4_imagenet + +|模型名称|efficientnetb4_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|EfficientNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|77MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - EfficientNet 是谷歌的开源新模型,是一个轻量级网络,它的主干网络由 MBConv 构成,同时采取了 squeeze-and-excitation 操作对网络结构进行优化。该 PaddleHub Module结构为 EfficientNetB4,基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install efficientnetb4_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run efficientnetb4_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m efficientnetb4_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.1.0 + + 提升预测性能以及易用性 + - ```shell + $ hub install efficientnetb4_imagenet==1.1.0 + ``` diff --git a/modules/image/classification/efficientnetb5_imagenet/README.md b/modules/image/classification/efficientnetb5_imagenet/README.md new file mode 100644 index 000000000..3c8a4bc37 --- /dev/null +++ b/modules/image/classification/efficientnetb5_imagenet/README.md @@ -0,0 +1,137 @@ +# efficientnetb5_imagenet + +|模型名称|efficientnetb5_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|EfficientNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|121MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - EfficientNet 是谷歌的开源新模型,是一个轻量级网络,它的主干网络由 MBConv 构成,同时采取了 squeeze-and-excitation 操作对网络结构进行优化。该 PaddleHub Module结构为 EfficientNetB5,基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install efficientnetb5_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run efficientnetb5_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m efficientnetb5_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.1.0 + + 提升预测性能以及易用性 + - ```shell + $ hub install efficientnetb5_imagenet==1.1.0 + ``` diff --git a/modules/image/classification/efficientnetb6_imagenet/README.md b/modules/image/classification/efficientnetb6_imagenet/README.md new file mode 100644 index 000000000..746ff1a71 --- /dev/null +++ b/modules/image/classification/efficientnetb6_imagenet/README.md @@ -0,0 +1,136 @@ +# efficientnetb6_imagenet + +|模型名称|efficientnetb6_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|EfficientNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|170MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - EfficientNet 是谷歌的开源新模型,是一个轻量级网络,它的主干网络由 MBConv 构成,同时采取了 squeeze-and-excitation 操作对网络结构进行优化。该 PaddleHub Module结构为 EfficientNetB6,基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install efficientnetb6_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run efficientnetb6_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m efficientnetb6_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.1.0 + + 提升预测性能以及易用性 + - ```shell + $ hub install efficientnetb6_imagenet==1.1.0 + ``` diff --git a/modules/image/classification/efficientnetb7_imagenet/README.md b/modules/image/classification/efficientnetb7_imagenet/README.md new file mode 100644 index 000000000..bef07051b --- /dev/null +++ b/modules/image/classification/efficientnetb7_imagenet/README.md @@ -0,0 +1,137 @@ +# efficientnetb7_imagenet + +|模型名称|efficientnetb7_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|EfficientNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|260MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - EfficientNet 是谷歌的开源新模型,是一个轻量级网络,它的主干网络由 MBConv 构成,同时采取了 squeeze-and-excitation 操作对网络结构进行优化。该 PaddleHub Module结构为 EfficientNetB7,基于 ImageNet-2012 数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install efficientnetb7_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run efficientnetb7_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m efficientnetb7_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.1.0 + + 提升预测性能以及易用性 + - ```shell + $ hub install efficientnetb7_imagenet==1.1.0 + ``` diff --git a/modules/image/classification/fix_resnext101_32x48d_wsl_imagenet/README.md b/modules/image/classification/fix_resnext101_32x48d_wsl_imagenet/README.md index 12c673852..ef750cec4 100644 --- a/modules/image/classification/fix_resnext101_32x48d_wsl_imagenet/README.md +++ b/modules/image/classification/fix_resnext101_32x48d_wsl_imagenet/README.md @@ -1,149 +1,134 @@ -## 命令行预测 +# fix_resnext101_32x48d_wsl_imagenet -``` -hub run fix_resnext101_32x48d_wsl_imagenet --input_path "/PATH/TO/IMAGE" -``` +|模型名称|fix_resnext101_32x48d_wsl_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|3.1GB| +|最新更新日期|-| +|数据指标|-| -## API -```python -def get_expected_image_width() -``` +## 一、模型基本信息 -返回预处理的图片宽度,也就是224。 -```python -def get_expected_image_height() -``` -返回预处理的图片高度,也就是224。 +- ### 模型介绍 -```python -def get_pretrained_images_mean() -``` + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 -返回预处理的图片均值,也就是 \[0.485, 0.456, 0.406\]。 -```python -def get_pretrained_images_std() -``` +## 二、安装 -返回预处理的图片标准差,也就是 \[0.229, 0.224, 0.225\]。 +- ### 1、环境依赖 + - paddlepaddle >= 1.6.2 -```python -def context(trainable=True, pretrained=True) -``` + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) -**参数** -* trainable (bool): 计算图的参数是否为可训练的; -* pretrained (bool): 是否加载默认的预训练模型。 +- ### 2、安装 -**返回** + - ```shell + $ hub install fix_resnext101_32x48d_wsl_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) -* inputs (dict): 计算图的输入,key 为 'image', value 为图片的张量; -* outputs (dict): 计算图的输出,key 为 'classification' 和 'feature_map',其相应的值为: - * classification (paddle.fluid.framework.Variable): 分类结果,也就是全连接层的输出; - * feature\_map (paddle.fluid.framework.Variable): 特征匹配,全连接层前面的那个张量。 -* context\_prog(fluid.Program): 计算图,用于迁移学习。 +## 三、模型API预测 -```python -def classification(images=None, - paths=None, - batch_size=1, - use_gpu=False, - top_k=1): -``` +- ### 1、命令行预测 -**参数** + - ```shell + $ hub run fix_resnext101_32x48d_wsl_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) -* images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR; -* paths (list\[str\]): 图片的路径; -* batch\_size (int): batch 的大小; -* use\_gpu (bool): 是否使用 GPU 来预测; -* top\_k (int): 返回预测结果的前 k 个。 +- ### 2、预测代码示例 -**返回** + - ```python + import paddlehub as hub + import cv2 -res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别动物的类别,value为置信度。 + 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']) + ``` -```python -def save_inference_model(dirname, - model_filename=None, - params_filename=None, - combined=True) -``` +- ### 3、API -将模型保存到指定路径。 -**参数** + - ```python + def classification(images=None, + paths=None, + batch_size=1, + use_gpu=False, + top_k=1): + ``` + - 分类接口API。 + - **参数** -* dirname: 存在模型的目录名称 -* model\_filename: 模型文件名称,默认为\_\_model\_\_ -* params\_filename: 参数文件名称,默认为\_\_params\_\_(仅当`combined`为True时生效) -* combined: 是否将参数保存到统一的一个文件中 + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 -## 代码示例 + - **返回** -```python -import paddlehub as hub -import cv2 + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 -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']) -``` -## 服务部署 -PaddleHub Serving可以部署一个在线图像识别服务。 +## 四、服务部署 -## 第一步:启动PaddleHub Serving +- PaddleHub Serving可以部署一个图像识别的在线服务。 -运行启动命令: -```shell -$ hub serving start -m fix_resnext101_32x48d_wsl_imagenet -``` +- ### 第一步:启动PaddleHub Serving -这样就完成了一个在线图像识别服务化API的部署,默认端口号为8866。 + - 运行启动命令: + - ```shell + $ hub serving start -m fix_resnext101_32x48d_wsl_imagenet + ``` -**NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 -## 第二步:发送预测请求 + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 -配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 +- ### 第二步:发送预测请求 -```python -import requests -import json -import cv2 -import base64 + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + - ```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') + def cv2_to_base64(image): + data = cv2.imencode('.jpg', image)[1] + return base64.b64encode(data.tostring()).decode('utf8') + # 发送HTTP请求 + 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)) -# 发送HTTP请求 -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(r.json()["results"]) + ``` -# 打印预测结果 -print(r.json()["results"]) -``` -### 查看代码 +## 五、更新历史 -https://github.com/PaddlePaddle/PaddleClas +* 1.0.0 -### 依赖 - -paddlepaddle >= 1.6.2 - -paddlehub >= 1.6.0 + 初始发布 + - ```shell + $ hub install fix_resnext101_32x48d_wsl_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/food_classification/README.md b/modules/image/classification/food_classification/README.md index 138bfcf03..01f910138 100644 --- a/modules/image/classification/food_classification/README.md +++ b/modules/image/classification/food_classification/README.md @@ -1,84 +1,90 @@ -# food_classification - -类别 图像 - 图像分类 - -网络 ResNet50_vd_ssld - - -> 模型概述 - -美食分类(food_classification),该模型可识别苹果派,小排骨,烤面包,牛肉馅饼,牛肉鞑靼。该PaddleHub Module支持API预测及命令行预测。 - -> 选择模型版本进行安装 - -```shell -$ hub install food_classification==1.0.0 -``` -> Module API说明 - -```python -def predict(self, - images=None, - paths=None, - batch_size=1, - use_gpu=False, - **kwargs): -``` -美食分类预测接口,输入一张图像,输出该图像上食物的类别 - -参数 - -* images (list[numpy.ndarray]): 图片数据,ndarray.shape 为 [H, W, C],BGR格式; -* paths (list[str]): 图片的路径; -* batch_size (int): batch 的大小; -* use_gpu (bool): 是否使用 GPU; - -返回 - -* res (list[dict]): 识别结果的列表,列表中每一个元素为 dict,各字段为: - * category_id (int): 类别的id; - * category(str): 类别; - * score(float): 准确率; - -## 代码示例 - -### API调用 - -```python -import cv2 -import paddlehub as hub - -module = hub.Module(name="food_classification") - -images = [cv2.imread('PATH/TO/IMAGE')] - -# execute predict and print the result -results = module.predict(images=images) -for result in results: - print(result) -``` - -### 命令行调用 -```shell -$ hub run food_classification --input_path /PATH/TO/IMAGE --use_gpu True -``` - -## 效果展示 - -### 原图 - - -### 输出结果 -```python -[{'category_id': 0, 'category': 'apple_pie', 'score': 0.9985085}] -``` - -## 贡献者 -彭兆帅、郑博培 - -## 依赖 -paddlepaddle >= 2.0.0 - -paddlehub >= 2.0.0 - -paddlex >= 1.3.7 +# food_classification + +|模型名称|food_classification| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet50_vd_ssld| +|数据集|美食数据集| +|是否支持Fine-tuning|否| +|模型大小|91MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 美食分类(food_classification),该模型可识别苹果派,小排骨,烤面包,牛肉馅饼,牛肉鞑靼。该PaddleHub Module支持API预测及命令行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 2.0.0 + + - paddlehub >= 2.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + - paddlex >= 1.3.7 + + +- ### 2、安装 + + - ```shell + $ hub install food_classification + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run food_classification --input_path /PATH/TO/IMAGE + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - images:list类型,待检测的图像。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型: + - category_id (int): 类别的id; + - category(str): 类别; + - score(float): 准确率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install food_classification==1.0.0 + ``` diff --git a/modules/image/classification/food_classification/requirements.txt b/modules/image/classification/food_classification/requirements.txt index ad3206643..f3c5b8fb1 100644 --- a/modules/image/classification/food_classification/requirements.txt +++ b/modules/image/classification/food_classification/requirements.txt @@ -1,3 +1,3 @@ paddlepaddle >= 2.0.0 paddlehub >= 2.0.0 -paddlex >= 1.3.7 +paddlex == 1.3.7 diff --git a/modules/image/classification/googlenet_imagenet/README.md b/modules/image/classification/googlenet_imagenet/README.md new file mode 100644 index 000000000..7dec0850a --- /dev/null +++ b/modules/image/classification/googlenet_imagenet/README.md @@ -0,0 +1,84 @@ +# googlenet_imagenet + +|模型名称|googlenet_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|GoogleNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|28MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - GoogleNet是图像分类中的经典模型。由Christian Szegedy等人在2014年提出,并获得了2014年ILSVRC竞赛冠军。该PaddleHub Module结构为GoogleNet,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install googlenet_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run googlenet_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install googlenet_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/inception_v4_imagenet/README.md b/modules/image/classification/inception_v4_imagenet/README.md new file mode 100644 index 000000000..ca8d613ee --- /dev/null +++ b/modules/image/classification/inception_v4_imagenet/README.md @@ -0,0 +1,84 @@ +# inception_v4_imagenet + +|模型名称|inception_v4_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|Inception_V4| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|167MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - Inception 结构最初由 GoogLeNet 引入,因此 GoogLeNet 也被称为 Inception-v1,通过在 Inception-v1 的基础上引入Batch Normalization、分解、残差连接等技术,设计出了Inception-v4。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install inception_v4_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run inception_v4_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率。 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install inception_v4_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/marine_biometrics/README.md b/modules/image/classification/marine_biometrics/README.md index 6ba7acd92..797288aee 100644 --- a/modules/image/classification/marine_biometrics/README.md +++ b/modules/image/classification/marine_biometrics/README.md @@ -1,69 +1,85 @@ -marine_biometrics - -类别 图像 - 图像分类 - -网络 ResNet50_vd_ssld - -数据集 Fish4Knowledge - -# 模型概述 -海洋生物识别(marine_biometrics),该模型可准确识别鱼的种类。该PaddleHub Module支持API预测及命令行预测。 - -# 选择模型版本进行安装 -$ hub install marine_biometrics==1.0.0 - -# 在线体验 -[AI Studio快速体验](https://aistudio.baidu.com/aistudio/projectdetail/1667809) - -# 命令行预测示例 -$ hub run marine_biometrics --image 1.png --use_gpu True - -# Module API说明 -## def predict(data) -海洋生物识别预测接口,输入一张图像,输出该图像上鱼的类别 -### 参数 -- data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 - -### 返回 -- result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 - -# 代码示例 - -## API调用 - -~~~ -import cv2 -import paddlehub as hub - -module = hub.Module(name="MarineBiometrics") - -images = [cv2.imread('PATH/TO/IMAGE')] - -# execute predict and print the result -results = module.predict(images=images) -for result in results: - print(result) -~~~ - -## 命令行调用 -~~~ -$ hub run marine_biometrics --image 1.png --use_gpu True -~~~ - -# 效果展示 - -## 原图 - - -## 输出结果 -~~~ -[{'category_id': 16, 'category': 'Plectroglyphidodon_dickii', 'score': 0.9932127}] -~~~ - -# 贡献者 -郑博培、彭兆帅 - -# 依赖 -paddlepaddle >= 2.0.0 - -paddlehub >= 2.0.0 +# marine_biometrics + +|模型名称|marine_biometrics| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet50_vd_ssld| +|数据集|Fish4Knowledge| +|是否支持Fine-tuning|否| +|模型大小|84MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 海洋生物识别(marine_biometrics),该模型可准确识别鱼的种类。该PaddleHub Module支持API预测及命令行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 2.0.0 + + - paddlehub >= 2.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install marine_biometrics + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run marine_biometrics --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - images:list类型,待检测的图像。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install marine_biometrics==1.0.0 + ``` diff --git a/modules/image/classification/marine_biometrics/requirements.txt b/modules/image/classification/marine_biometrics/requirements.txt new file mode 100644 index 000000000..307c5de76 --- /dev/null +++ b/modules/image/classification/marine_biometrics/requirements.txt @@ -0,0 +1 @@ +paddlex==1.3.7 diff --git a/modules/image/classification/mobilenet_v2_animals/README.md b/modules/image/classification/mobilenet_v2_animals/README.md index f1824d653..e1ba58dcd 100644 --- a/modules/image/classification/mobilenet_v2_animals/README.md +++ b/modules/image/classification/mobilenet_v2_animals/README.md @@ -1,159 +1,134 @@ -```shell -$ hub install mobilenet_v2_animals==1.0.0 -``` +# mobilenet_v2_animals -

-
MobileNet 系列的网络结构 -

+|模型名称|mobilenet_v2_animals| +| :--- | :---: | +|类别|图像-图像分类| +|网络|MobileNet_v2| +|数据集|百度自建动物数据集| +|是否支持Fine-tuning|否| +|模型大小|50MB| +|最新更新日期|-| +|数据指标|-| -模型的详情可参考[论文](https://arxiv.org/pdf/1801.04381.pdf) -## 命令行预测 +## 一、模型基本信息 -``` -hub run mobilenet_v2_animals --input_path "/PATH/TO/IMAGE" -``` -## API -```python -def get_expected_image_width() -``` +- ### 模型介绍 -返回预处理的图片宽度,也就是224。 + - MobileNet V2 是一个轻量化的卷积神经网络,它在 MobileNet 的基础上,做了 Inverted Residuals 和 Linear bottlenecks 这两大改进。该 PaddleHub Module 是在百度自建动物数据集上训练得到的,可用于图像分类和特征提取,当前已支持7978种动物的分类识别。模型的详情可参考[论文](https://arxiv.org/pdf/1801.04381.pdf)。 -```python -def get_expected_image_height() -``` -返回预处理的图片高度,也就是224。 -```python -def get_pretrained_images_mean() -``` +## 二、安装 -返回预处理的图片均值,也就是 \[0.485, 0.456, 0.406\]。 +- ### 1、环境依赖 -```python -def get_pretrained_images_std() -``` + - paddlepaddle >= 1.6.2 -返回预处理的图片标准差,也就是 \[0.229, 0.224, 0.225\]。 + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) -```python -def context(trainable=True, pretrained=True) -``` +- ### 2、安装 -**参数** + - ```shell + $ hub install mobilenet_v2_animals + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) -* trainable (bool): 计算图的参数是否为可训练的; -* pretrained (bool): 是否加载默认的预训练模型。 +## 三、模型API预测 -**返回** +- ### 1、命令行预测 -* inputs (dict): 计算图的输入,key 为 'image', value 为图片的张量; -* outputs (dict): 计算图的输出,key 为 'classification' 和 'feature_map',其相应的值为: - * classification (paddle.fluid.framework.Variable): 分类结果,也就是全连接层的输出; - * feature\_map (paddle.fluid.framework.Variable): 特征匹配,全连接层前面的那个张量。 -* context\_prog(fluid.Program): 计算图,用于迁移学习。 + - ```shell + $ hub run mobilenet_v2_animals --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) -```python -def classification(images=None, - paths=None, - batch_size=1, - use_gpu=False, - top_k=1): -``` +- ### 2、预测代码示例 -**参数** + - ```python + import paddlehub as hub + import cv2 -* images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR; -* paths (list\[str\]): 图片的路径; -* batch\_size (int): batch 的大小; -* use\_gpu (bool): 是否使用 GPU 来预测; -* top\_k (int): 返回预测结果的前 k 个。 + 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 -res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别动物的类别,value为置信度。 -```python -def save_inference_model(dirname, - model_filename=None, - params_filename=None, - combined=True) -``` + - ```python + def classification(images=None, + paths=None, + batch_size=1, + use_gpu=False, + top_k=1): + ``` + - 分类接口API。 + - **参数** -将模型保存到指定路径。 + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 -**参数** + - **返回** -* dirname: 存在模型的目录名称 -* model_filename: 模型文件名称,默认为\_\_model\_\_ -* params_filename: 参数文件名称,默认为\_\_params\_\_(仅当`combined`为True时生效) -* combined: 是否将参数保存到统一的一个文件中 + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 -## 代码示例 -```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']) -``` +- PaddleHub Serving可以部署一个动物识别的在线服务。 -## 服务部署 +- ### 第一步:启动PaddleHub Serving -PaddleHub Serving可以部署一个在线动物识别服务。 + - 运行启动命令: + - ```shell + $ hub serving start -m mobilenet_v2_animals + ``` -## 第一步:启动PaddleHub Serving + - 这样就完成了一个动物识别的在线服务的部署,默认端口号为8866。 -运行启动命令: -```shell -$ hub serving start -m mobilenet_v2_animals -``` + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 -这样就完成了一个在线动物识别服务化API的部署,默认端口号为8866。 +- ### 第二步:发送预测请求 -**NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 -## 第二步:发送预测请求 + - ```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') -```python -import requests -import json -import cv2 -import base64 + # 发送HTTP请求 + 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(r.json()["results"]) + ``` -def cv2_to_base64(image): - data = cv2.imencode('.jpg', image)[1] - return base64.b64encode(data.tostring()).decode('utf8') +## 五、更新历史 -# 发送HTTP请求 -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)) +* 1.0.0 -# 打印预测结果 -print(r.json()["results"]) -``` - -### 查看代码 - -[PaddlePaddle/models 图像分类](https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification) - -### 依赖 - -paddlepaddle >= 1.6.2 - -paddlehub >= 1.6.0 + 初始发布 + - ```shell + $ hub install mobilenet_v2_animals==1.0.0 + ``` diff --git a/modules/image/classification/mobilenet_v2_dishes/README.md b/modules/image/classification/mobilenet_v2_dishes/README.md index cdbd1c048..aad927459 100644 --- a/modules/image/classification/mobilenet_v2_dishes/README.md +++ b/modules/image/classification/mobilenet_v2_dishes/README.md @@ -1,159 +1,139 @@ -```shell -$ hub install mobilenet_v2_dishes==1.0.0 -``` +# mobilenet_v2_dishes -

-
MobileNet 系列的网络结构 -

- -模型的详情可参考[论文](https://arxiv.org/pdf/1801.04381.pdf) - -## 命令行预测 +|模型名称|mobilenet_v2_dishes| +| :--- | :---: | +|类别|图像-图像分类| +|网络|MobileNet_v2| +|数据集|百度自建菜品数据集| +|是否支持Fine-tuning|否| +|模型大小|52MB| +|最新更新日期|-| +|数据指标|-| -``` -hub run mobilenet_v2_dishes --input_path "/PATH/TO/IMAGE" -``` -## API +## 一、模型基本信息 -```python -def get_expected_image_width() -``` -返回预处理的图片宽度,也就是224。 -```python -def get_expected_image_height() -``` +- ### 模型介绍 -返回预处理的图片高度,也就是224。 + - MobileNet V2 是一个轻量化的卷积神经网络,它在 MobileNet 的基础上,做了 Inverted Residuals 和 Linear bottlenecks 这两大改进。该 PaddleHub Module 是在百度自建菜品数据集上训练得到的,可用于图像分类和特征提取,当前已支持8416种菜品的分类识别。 -```python -def get_pretrained_images_mean() -``` - -返回预处理的图片均值,也就是 \[0.485, 0.456, 0.406\]。 - -```python -def get_pretrained_images_std() -``` +

+
+

-返回预处理的图片标准差,也就是 \[0.229, 0.224, 0.225\]。 + - 更多详情参考:[MobileNetV2: Inverted Residuals and Linear Bottlenecks](https://arxiv.org/pdf/1801.04381.pdf) +## 二、安装 -```python -def context(trainable=True, pretrained=True) -``` +- ### 1、环境依赖 -**参数** + - paddlepaddle >= 1.6.2 -* trainable (bool): 计算图的参数是否为可训练的; -* pretrained (bool): 是否加载默认的预训练模型。 + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) -**返回** -* inputs (dict): 计算图的输入,key 为 'image', value 为图片的张量; -* outputs (dict): 计算图的输出,key 为 'classification' 和 'feature_map',其相应的值为: - * classification (paddle.fluid.framework.Variable): 分类结果,也就是全连接层的输出; - * feature\_map (paddle.fluid.framework.Variable): 特征匹配,全连接层前面的那个张量。 -* context\_prog(fluid.Program): 计算图,用于迁移学习。 +- ### 2、安装 -```python -def classification(images=None, - paths=None, - batch_size=1, - use_gpu=False, - top_k=1): -``` + - ```shell + $ hub install mobilenet_v2_dishes + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) -**参数** +## 三、模型API预测 -* images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR; -* paths (list\[str\]): 图片的路径; -* batch\_size (int): batch 的大小; -* use\_gpu (bool): 是否使用 GPU 来预测; -* top\_k (int): 返回预测结果的前 k 个。 +- ### 1、命令行预测 -**返回** + - ```shell + $ hub run mobilenet_v2_dishes --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现菜品分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) -res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 +- ### 2、预测代码示例 -```python -def save_inference_model(dirname, - model_filename=None, - params_filename=None, - combined=True) -``` + - ```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 -* dirname: 存在模型的目录名称 -* model_filename: 模型文件名称,默认为\_\_model\_\_ -* params_filename: 参数文件名称,默认为\_\_params\_\_(仅当`combined`为True时生效) -* combined: 是否将参数保存到统一的一个文件中 + - ```python + def classification(images=None, + paths=None, + batch_size=1, + use_gpu=False, + top_k=1): + ``` + - 分类接口API。 + - **参数** -## 代码示例 + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 -```python -import paddlehub as hub -import cv2 + - **返回** -classifier = hub.Module(name="mobilenet_v2_dishes") + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 -result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')]) -# or -# result = classifier.classification(paths=['/PATH/TO/IMAGE']) -``` -## 服务部署 -PaddleHub Serving可以部署一个菜品分类的在线服务。 -## 第一步:启动PaddleHub Serving +## 四、服务部署 -运行启动命令: -```shell -$ hub serving start -m mobilenet_v2_dishes -``` +- PaddleHub Serving可以部署一个菜品分类的在线服务。 -这样就完成了一个菜品分类的在线服务的部署,默认端口号为8866。 +- ### 第一步:启动PaddleHub Serving -**NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + - 运行启动命令: + - ```shell + $ hub serving start -m mobilenet_v2_dishes + ``` -## 第二步:发送预测请求 + - 这样就完成了一个菜品分类的在线服务的部署,默认端口号为8866。 -配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 -```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') + - ```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') -# 发送HTTP请求 -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)) + # 发送HTTP请求 + 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(r.json()["results"]) -``` + # 打印预测结果 + print(r.json()["results"]) + ``` -### 查看代码 -[PaddlePaddle/models 图像分类](https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification) +## 五、更新历史 -### 依赖 +* 1.0.0 -paddlepaddle >= 1.6.2 + 初始发布 -paddlehub >= 1.6.0 + - ```shell + $ hub install mobilenet_v2_dishes==1.0.0 + ``` diff --git a/modules/image/classification/mobilenet_v2_imagenet/README.md b/modules/image/classification/mobilenet_v2_imagenet/README.md new file mode 100644 index 000000000..7b9bb0f7e --- /dev/null +++ b/modules/image/classification/mobilenet_v2_imagenet/README.md @@ -0,0 +1,88 @@ +# mobilenet_v2_imagenet + +|模型名称|mobilenet_v2_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|Mobilenet_v2| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|15MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - MobileNet V2是Mark Sandler, Andrew Howard等人在2018年提出的一个图像分类模型,该系列模型(MobileNet)是为移动和嵌入式设备提出的高效模型,在模型参数较少的情况下仍然保持了较高的分类准确率。该PaddleHub Module基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install mobilenet_v2_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run mobilenet_v2_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.0.1 + + 修复python2中编码问题 + + - ```shell + $ hub install mobilenet_v2_imagenet==1.0.1 + ``` diff --git a/modules/image/classification/mobilenet_v2_imagenet_ssld/README.md b/modules/image/classification/mobilenet_v2_imagenet_ssld/README.md new file mode 100644 index 000000000..4529275ac --- /dev/null +++ b/modules/image/classification/mobilenet_v2_imagenet_ssld/README.md @@ -0,0 +1,133 @@ +# mobilenet_v2_imagenet_ssld + +|模型名称|mobilenet_v2_imagenet_ssld| +| :--- | :---: | +|类别|图像-图像分类| +|网络|Mobilenet_v2| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|15MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - MobileNet V2是Mark Sandler, Andrew Howard等人在2018年提出的一个图像分类模型,该系列模型(MobileNet)是为移动和嵌入式设备提出的高效模型,在模型参数较少的情况下仍然保持了较高的分类准确率。该PaddleHub Module基于ImageNet-2012数据集并采用PaddleClas提供的SSLD蒸馏方法训练得到,接受输入图片大小为224 x 224 x 3,支持finetune,也可以直接通过命令行或者Python接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install mobilenet_v2_imagenet_ssld + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run mobilenet_v2_imagenet_ssld --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m mobilenet_v2_imagenet_ssld + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install mobilenet_v2_imagenet_ssld==1.0.0 + ``` diff --git a/modules/image/classification/mobilenet_v3_large_imagenet_ssld/README.md b/modules/image/classification/mobilenet_v3_large_imagenet_ssld/README.md new file mode 100644 index 000000000..03cf9d75f --- /dev/null +++ b/modules/image/classification/mobilenet_v3_large_imagenet_ssld/README.md @@ -0,0 +1,135 @@ +# mobilenet_v3_large_imagenet_ssld + +|模型名称|mobilenet_v3_large_imagenet_ssld| +| :--- | :---: | +|类别|图像-图像分类| +|网络|Mobilenet_v3_large| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|23MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - MobileNetV3是Google在2019年发布的新模型,作者通过结合NAS与NetAdapt进行搜索得到该网络结构,提供了Large和Small两个版本,分别适用于对资源不同要求的情况。对比于MobileNetV2,新的模型在速度和精度方面均有提升。该PaddleHubModule的模型结构为MobileNetV3 Large,基于ImageNet-2012数据集并采用PaddleClas提供的SSLD蒸馏方法训练得到,接受输入图片大小为224 x 224 x 3,支持finetune,也可以直接通过命令行或者Python接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install mobilenet_v3_large_imagenet_ssld + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run mobilenet_v3_large_imagenet_ssld --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m mobilenet_v3_large_imagenet_ssld + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install mobilenet_v3_large_imagenet_ssld==1.0.0 + ``` diff --git a/modules/image/classification/mobilenet_v3_small_imagenet_ssld/README.md b/modules/image/classification/mobilenet_v3_small_imagenet_ssld/README.md new file mode 100644 index 000000000..bdcd47588 --- /dev/null +++ b/modules/image/classification/mobilenet_v3_small_imagenet_ssld/README.md @@ -0,0 +1,134 @@ +# mobilenet_v3_small_imagenet_ssld + +|模型名称|mobilenet_v3_small_imagenet_ssld| +| :--- | :---: | +|类别|图像-图像分类| +|网络|Mobilenet_v3_Small| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|13MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - MobileNetV3是Google在2019年发布的新模型,作者通过结合NAS与NetAdapt进行搜索得到该网络结构,提供了Large和Small两个版本,分别适用于对资源不同要求的情况。对比于MobileNetV2,新的模型在速度和精度方面均有提升。该PaddleHubModule的模型结构为MobileNetV3 Small,基于ImageNet-2012数据集并采用PaddleClas提供的SSLD蒸馏方法训练得到,接受输入图片大小为224 x 224 x 3,支持finetune,也可以直接通过命令行或者Python接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install mobilenet_v3_small_imagenet_ssld + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run mobilenet_v3_small_imagenet_ssld --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m mobilenet_v3_small_imagenet_ssld + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install mobilenet_v3_small_imagenet_ssld==1.0.0 + ``` diff --git a/modules/image/classification/nasnet_imagenet/README.md b/modules/image/classification/nasnet_imagenet/README.md new file mode 100644 index 000000000..b9ca44eb5 --- /dev/null +++ b/modules/image/classification/nasnet_imagenet/README.md @@ -0,0 +1,87 @@ +# nasnet_imagenet + +|模型名称|nasnet_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|NASNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|345MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - NASNet是Google通过AutoML自动训练出来的图像分类模型。该PaddleHub Module基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install nasnet_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run nasnet_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.0.1 + + 修复python2中编码问题 + - ```shell + $ hub install nasnet_imagenet==1.0.1 + ``` diff --git a/modules/image/classification/pnasnet_imagenet/README.md b/modules/image/classification/pnasnet_imagenet/README.md new file mode 100644 index 000000000..e87ff0721 --- /dev/null +++ b/modules/image/classification/pnasnet_imagenet/README.md @@ -0,0 +1,87 @@ +# pnasnet_imagenet + +|模型名称|pnasnet_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|PNASNet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|333MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - PNASNet是Google通过AutoML自动训练出来的图像分类模型。该PaddleHub Module基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install pnasnet_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run pnasnet_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.0.1 + + 修复python2中编码问题 + - ```shell + $ hub install pnasnet_imagenet==1.0.1 + ``` diff --git a/modules/image/classification/res2net101_vd_26w_4s_imagenet/README.md b/modules/image/classification/res2net101_vd_26w_4s_imagenet/README.md index 25c1fcb33..75f10a97f 100644 --- a/modules/image/classification/res2net101_vd_26w_4s_imagenet/README.md +++ b/modules/image/classification/res2net101_vd_26w_4s_imagenet/README.md @@ -1,149 +1,134 @@ -## 命令行预测 +# res2net101_vd_26w_4s_imagenet -``` -hub run res2net101_vd_26w_4s_imagenet --input_path "/PATH/TO/IMAGE" -``` +|模型名称|res2net101_vd_26w_4s_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|Res2Net| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|179MB| +|最新更新日期|-| +|数据指标|-| -## API -```python -def get_expected_image_width() -``` +## 一、模型基本信息 -返回预处理的图片宽度,也就是224。 -```python -def get_expected_image_height() -``` -返回预处理的图片高度,也就是224。 +- ### 模型介绍 -```python -def get_pretrained_images_mean() -``` + - Res2Net是2019年提出的一种全新的对ResNet的改进方案,该方案可以和现有其他优秀模块轻松整合,在不增加计算负载量的情况下,在ImageNet、CIFAR-100等数据集上的测试性能超过了ResNet。Res2Net结构简单,性能优越,进一步探索了CNN在更细粒度级别的多尺度表示能力。 该 PaddleHub Module 使用 ImageNet-2012数据集训练,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 -返回预处理的图片均值,也就是 \[0.485, 0.456, 0.406\]。 -```python -def get_pretrained_images_std() -``` +## 二、安装 -返回预处理的图片标准差,也就是 \[0.229, 0.224, 0.225\]。 +- ### 1、环境依赖 + - paddlepaddle >= 1.6.2 -```python -def context(trainable=True, pretrained=True) -``` + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) -**参数** -* trainable (bool): 计算图的参数是否为可训练的; -* pretrained (bool): 是否加载默认的预训练模型。 +- ### 2、安装 -**返回** + - ```shell + $ hub install res2net101_vd_26w_4s_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) -* inputs (dict): 计算图的输入,key 为 'image', value 为图片的张量; -* outputs (dict): 计算图的输出,key 为 'classification' 和 'feature_map',其相应的值为: - * classification (paddle.fluid.framework.Variable): 分类结果,也就是全连接层的输出; - * feature\_map (paddle.fluid.framework.Variable): 特征匹配,全连接层前面的那个张量。 -* context\_prog(fluid.Program): 计算图,用于迁移学习。 +## 三、模型API预测 -```python -def classification(images=None, - paths=None, - batch_size=1, - use_gpu=False, - top_k=1): -``` +- ### 1、命令行预测 -**参数** + - ```shell + $ hub run res2net101_vd_26w_4s_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) -* images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR; -* paths (list\[str\]): 图片的路径; -* batch\_size (int): batch 的大小; -* use\_gpu (bool): 是否使用 GPU 来预测; -* top\_k (int): 返回预测结果的前 k 个。 +- ### 2、预测代码示例 -**返回** + - ```python + import paddlehub as hub + import cv2 -res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别动物的类别,value为置信度。 + 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']) + ``` -```python -def save_inference_model(dirname, - model_filename=None, - params_filename=None, - combined=True) -``` +- ### 3、API -将模型保存到指定路径。 -**参数** + - ```python + def classification(images=None, + paths=None, + batch_size=1, + use_gpu=False, + top_k=1): + ``` + - 分类接口API。 + - **参数** -* dirname: 存在模型的目录名称 -* model\_filename: 模型文件名称,默认为\_\_model\_\_ -* params\_filename: 参数文件名称,默认为\_\_params\_\_(仅当`combined`为True时生效) -* combined: 是否将参数保存到统一的一个文件中 + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 -## 代码示例 + - **返回** -```python -import paddlehub as hub -import cv2 + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 -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']) -``` -## 服务部署 +## 四、服务部署 -PaddleHub Serving可以部署一个在线图像识别服务。 +- PaddleHub Serving可以部署一个图像识别的在线服务。 -## 第一步:启动PaddleHub Serving +- ### 第一步:启动PaddleHub Serving -运行启动命令: -```shell -$ hub serving start -m res2net101_vd_26w_4s_imagenet -``` + - 运行启动命令: + - ```shell + $ hub serving start -m res2net101_vd_26w_4s_imagenet + ``` -这样就完成了一个在线图像识别服务化API的部署,默认端口号为8866。 + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 -**NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 -## 第二步:发送预测请求 +- ### 第二步:发送预测请求 -配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 -```python -import requests -import json -import cv2 -import base64 + - ```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') -def cv2_to_base64(image): - data = cv2.imencode('.jpg', image)[1] - return base64.b64encode(data.tostring()).decode('utf8') + # 发送HTTP请求 + 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(r.json()["results"]) + ``` -# 发送HTTP请求 -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(r.json()["results"]) -``` +## 五、更新历史 -### 查看代码 +* 1.0.0 -https://github.com/PaddlePaddle/PaddleClas + 初始发布 -### 依赖 - -paddlepaddle >= 1.6.2 - -paddlehub >= 1.6.0 + - ```shell + $ hub install res2net101_vd_26w_4s_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnet18_vd_imagenet/README.md b/modules/image/classification/resnet18_vd_imagenet/README.md new file mode 100644 index 000000000..a84af151b --- /dev/null +++ b/modules/image/classification/resnet18_vd_imagenet/README.md @@ -0,0 +1,136 @@ +# resnet18_vd_imagenet + +|模型名称|resnet18_vd_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet_vd| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|46MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNet系列模型是图像分类领域的重要模型之一,模型中提出的残差单元有效地解决了深度网络训练困难的问题,通过增加模型的深度提升了模型的准确率,ResNet-vd 其实就是 ResNet-D,是ResNet 原始结构的变种。该PaddleHub Module结构为ResNet_vd,基于ImageNet-2012数据集训练得到,接受输入图片大小为224 x 224 x 3,支持finetune,也可以直接通过命令行或者Python接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnet18_vd_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnet18_vd_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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): + ``` + - 分类接口API。 + - **参数** + + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 + + - **返回** + + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + + + + + +## 四、服务部署 + +- PaddleHub Serving可以部署一个图像识别的在线服务。 + +- ### 第一步:启动PaddleHub Serving + + - 运行启动命令: + - ```shell + $ hub serving start -m resnet18_vd_imagenet + ``` + + - 这样就完成了一个图像识别的在线服务的部署,默认端口号为8866。 + + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + +- ### 第二步:发送预测请求 + + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 + + - ```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') + + # 发送HTTP请求 + 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(r.json()["results"]) + ``` + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnet18_vd_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnet50_vd_10w/README.md b/modules/image/classification/resnet50_vd_10w/README.md new file mode 100644 index 000000000..35b736abf --- /dev/null +++ b/modules/image/classification/resnet50_vd_10w/README.md @@ -0,0 +1,95 @@ +# resnet50_vd_10w + +|模型名称|resnet50_vd_10w| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet_vd| +|数据集|百度自建数据集| +|是否支持Fine-tuning|否| +|模型大小|92MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNet系列模型是图像分类领域的重要模型之一,模型中提出的残差单元有效地解决了深度网络训练困难的问题,通过增加模型的深度提升了模型的准确率,ResNet-vd 其实就是 ResNet-D,是ResNet 原始结构的变种。该PaddleHub Module结构为ResNet_vd,使用百度自研的基于10万种类别、4千多万的有标签数据进行训练,接受输入图片大小为224 x 224 x 3,支持finetune。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.2 + + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnet50_vd_10w + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、预测代码示例 + + - ```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) + ``` + - **参数** + - trainable (bool): 计算图的参数是否为可训练的;
+ - pretrained (bool): 是否加载默认的预训练模型。 + + - **返回** + - inputs (dict): 计算图的输入,key 为 'image', value 为图片的张量;
+ - 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) + ``` + - **参数** + - dirname: 存在模型的目录名称;
+ - model_filename: 模型文件名称,默认为\_\_model\_\_;
+ - params_filename: 参数文件名称,默认为\_\_params\_\_(仅当`combined`为True时生效);
+ - combined: 是否将参数保存到统一的一个文件中。 + + + + + + +## 五、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnet50_vd_10w==1.0.0 + ``` diff --git a/modules/image/classification/resnet50_vd_dishes/README.md b/modules/image/classification/resnet50_vd_dishes/README.md index abd32a6ac..c5108d3d2 100644 --- a/modules/image/classification/resnet50_vd_dishes/README.md +++ b/modules/image/classification/resnet50_vd_dishes/README.md @@ -1,159 +1,140 @@ -```shell -$ hub install resnet50_vd_dishes==1.0.0 -``` +# resnet50_vd_dishes -

-
ResNet 系列的网络结构 -

- -模型的详情可参考[论文](https://arxiv.org/pdf/1812.01187.pdf) - -## 命令行预测 +|模型名称|resnet50_vd_dishes| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet50_vd| +|数据集|百度自建菜品数据集| +|是否支持Fine-tuning|否| +|模型大小|158MB| +|最新更新日期|-| +|数据指标|-| -``` -hub run resnet50_vd_dishes --input_path "/PATH/TO/IMAGE" -``` -## API +## 一、模型基本信息 -```python -def get_expected_image_width() -``` -返回预处理的图片宽度,也就是224。 -```python -def get_expected_image_height() -``` +- ### 模型介绍 -返回预处理的图片高度,也就是224。 + - ResNet-vd是ResNet原始结构的变种,可用于图像分类和特征提取。该 PaddleHub Module 采用百度自建菜品数据集训练得到,支持8416种菜品的分类识别。 -```python -def get_pretrained_images_mean() -``` - -返回预处理的图片均值,也就是 \[0.485, 0.456, 0.406\]。 +

+
+

-```python -def get_pretrained_images_std() -``` + - 更多详情参考:[Bag of Tricks for Image Classification with Convolutional Neural Networks](https://arxiv.org/pdf/1812.01187.pdf) -返回预处理的图片标准差,也就是 \[0.229, 0.224, 0.225\]。 +## 二、安装 +- ### 1、环境依赖 -```python -def context(trainable=True, pretrained=True) -``` + - paddlepaddle >= 1.6.2 -**参数** + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) -* trainable (bool): 计算图的参数是否为可训练的; -* pretrained (bool): 是否加载默认的预训练模型。 -**返回** +- ### 2、安装 -* inputs (dict): 计算图的输入,key 为 'image', value 为图片的张量; -* outputs (dict): 计算图的输出,key 为 'classification' 和 'feature_map',其相应的值为: - * classification (paddle.fluid.framework.Variable): 分类结果,也就是全连接层的输出; - * feature\_map (paddle.fluid.framework.Variable): 特征匹配,全连接层前面的那个张量。 -* context\_prog(fluid.Program): 计算图,用于迁移学习。 + - ```shell + $ hub install resnet50_vd_dishes + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) -```python -def classification(images=None, - paths=None, - batch_size=1, - use_gpu=False, - top_k=1): -``` +## 三、模型API预测 -**参数** +- ### 1、命令行预测 -* images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR; -* paths (list\[str\]): 图片的路径; -* batch\_size (int): batch 的大小; -* use\_gpu (bool): 是否使用 GPU 来预测; -* top\_k (int): 返回预测结果的前 k 个。 + - ```shell + $ hub run resnet50_vd_dishes --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现菜品分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) -**返回** +- ### 2、预测代码示例 -res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 + - ```python + import paddlehub as hub + import cv2 -```python -def save_inference_model(dirname, - model_filename=None, - params_filename=None, - combined=True) -``` + 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 -**参数** -* dirname: 存在模型的目录名称 -* model_filename: 模型文件名称,默认为\_\_model\_\_ -* params_filename: 参数文件名称,默认为\_\_params\_\_(仅当`combined`为True时生效) -* combined: 是否将参数保存到统一的一个文件中 + - ```python + def classification(images=None, + paths=None, + batch_size=1, + use_gpu=False, + top_k=1): + ``` + - 分类接口API。 + - **参数** -## 代码示例 + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 -```python -import paddlehub as hub -import cv2 + - **返回** -classifier = hub.Module(name="resnet50_vd_dishes") + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 -result = classifier.classification(images=[cv2.imread('/PATH/TO/IMAGE')]) -# or -# result = classifier.classification(paths=['/PATH/TO/IMAGE']) -``` -## 服务部署 -PaddleHub Serving可以部署一个菜品分类的在线服务。 -## 第一步:启动PaddleHub Serving +## 四、服务部署 -运行启动命令: -```shell -$ hub serving start -m resnet50_vd_dishes -``` +- PaddleHub Serving可以部署一个菜品分类的在线服务。 -这样就完成了一个菜品分类的在线服务的部署,默认端口号为8866。 +- ### 第一步:启动PaddleHub Serving -**NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + - 运行启动命令: + - ```shell + $ hub serving start -m resnet50_vd_dishes + ``` -## 第二步:发送预测请求 + - 这样就完成了一个菜品分类的在线服务的部署,默认端口号为8866。 -配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果。 + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 -```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') + - ```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') -# 发送HTTP请求 -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)) + # 发送HTTP请求 + 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(r.json()["results"]) -``` + # 打印预测结果 + print(r.json()["results"]) + ``` -### 查看代码 -[PaddlePaddle/models 图像分类](https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification) +## 五、更新历史 -### 依赖 +* 1.0.0 -paddlepaddle >= 1.6.2 + 初始发布 -paddlehub >= 1.6.0 + - ```shell + $ hub install resnet50_vd_dishes==1.0.0 + ``` diff --git a/modules/image/classification/resnet50_vd_wildanimals/README.md b/modules/image/classification/resnet50_vd_wildanimals/README.md index f4415cccc..d857c89b7 100644 --- a/modules/image/classification/resnet50_vd_wildanimals/README.md +++ b/modules/image/classification/resnet50_vd_wildanimals/README.md @@ -1,159 +1,134 @@ -```shell -$ hub install resnet50_vd_wildanimals==1.0.0 -``` +# resnet50_vd_wildanimals -

-
ResNet 系列的网络结构 -

+|模型名称|resnet50_vd_wildanimals| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet_vd| +|数据集|IFAW 自建野生动物数据集| +|是否支持Fine-tuning|否| +|模型大小|92MB| +|最新更新日期|-| +|数据指标|-| -模型的详情可参考[论文](https://arxiv.org/pdf/1812.01187.pdf) -## 命令行预测 +## 一、模型基本信息 -``` -hub run resnet50_vd_wildanimals --input_path "/PATH/TO/IMAGE" -``` -## API -```python -def get_expected_image_width() -``` +- ### 模型介绍 -返回预处理的图片宽度,也就是224。 + - ResNet-vd 其实就是 ResNet-D,是ResNet 原始结构的变种,可用于图像分类和特征提取。该 PaddleHub Module 采用百度自建野生动物数据集训练得到,支持'象牙制品','象牙', '大象', '虎皮', '老虎', '虎牙/虎爪/虎骨', '穿山甲甲片', '穿山甲', '穿山甲爪子', '其他' 这十个标签的识别。模型的详情可参考[论文](https://arxiv.org/pdf/1812.01187.pdf)。 -```python -def get_expected_image_height() -``` -返回预处理的图片高度,也就是224。 -```python -def get_pretrained_images_mean() -``` +## 二、安装 -返回预处理的图片均值,也就是 \[0.485, 0.456, 0.406\]。 +- ### 1、环境依赖 -```python -def get_pretrained_images_std() -``` + - paddlepaddle >= 1.6.2 -返回预处理的图片标准差,也就是 \[0.229, 0.224, 0.225\]。 + - paddlehub >= 1.6.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) -```python -def context(trainable=True, pretrained=True) -``` +- ### 2、安装 -**参数** + - ```shell + $ hub install resnet50_vd_wildanimals + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) -* trainable (bool): 计算图的参数是否为可训练的; -* pretrained (bool): 是否加载默认的预训练模型。 +## 三、模型API预测 -**返回** +- ### 1、命令行预测 -* inputs (dict): 计算图的输入,key 为 'image', value 为图片的张量; -* outputs (dict): 计算图的输出,key 为 'classification' 和 'feature\_map',其相应的值为: - * classification (paddle.fluid.framework.Variable): 分类结果,也就是全连接层的输出; - * feature\_map (paddle.fluid.framework.Variable): 特征匹配,全连接层前面的那个张量。 -* context\_prog(fluid.Program): 计算图,用于迁移学习。 + - ```shell + $ hub run resnet50_vd_wildanimals --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) -```python -def classification(images=None, - paths=None, - batch_size=1, - use_gpu=False, - top_k=1): -``` +- ### 2、预测代码示例 -**参数** + - ```python + import paddlehub as hub + import cv2 -* images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR; -* paths (list\[str\]): 图片的路径; -* batch\_size (int): batch 的大小; -* use\_gpu (bool): 是否使用 GPU 来预测; -* top\_k (int): 返回预测结果的前 k 个。 + 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 -res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别动物的类别,value为置信度。 -```python -def save_inference_model(dirname, - model_filename=None, - params_filename=None, - combined=True) -``` + - ```python + def classification(images=None, + paths=None, + batch_size=1, + use_gpu=False, + top_k=1): + ``` + - 分类接口API。 + - **参数** -将模型保存到指定路径。 + - images (list\[numpy.ndarray\]): 图片数据,每一个图片数据的shape 均为 \[H, W, C\],颜色空间为 BGR;
+ - paths (list\[str\]): 图片的路径;
+ - batch\_size (int): batch 的大小;
+ - use\_gpu (bool): 是否使用 GPU;**若使用GPU,请先设置CUDA_VISIBLE_DEVICES环境变量**
+ - top\_k (int): 返回预测结果的前 k 个。 -**参数** + - **返回** -* dirname: 存在模型的目录名称 -* model\_filename: 模型文件名称,默认为\_\_model\_\_ -* params\_filename: 参数文件名称,默认为\_\_params\_\_(仅当`combined`为True时生效) -* combined: 是否将参数保存到统一的一个文件中 + - res (list\[dict\]): 分类结果,列表的每一个元素均为字典,其中 key 为识别的菜品类别,value为置信度。 -## 代码示例 -```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']) -``` +- PaddleHub Serving可以部署一个野生动物及其制品识别的在线服务。 -## 服务部署 +- ### 第一步:启动PaddleHub Serving -PaddleHub Serving可以部署一个野生动物及其制品的在线识别服务。 + - 运行启动命令: + - ```shell + $ hub serving start -m resnet50_vd_wildanimals + ``` -## 第一步:启动PaddleHub Serving + - 这样就完成了一个野生动物及其制品识别的在线服务的部署,默认端口号为8866。 -运行启动命令: -```shell -$ hub serving start -m resnet50_vd_wildanimals -``` + - **NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 -这样就完成了一个野生动物及其制品的在线服务的部署,默认端口号为8866。 +- ### 第二步:发送预测请求 -**NOTE:** 如使用GPU预测,则需要在启动服务之前,请设置CUDA\_VISIBLE\_DEVICES环境变量,否则不用设置。 + - 配置好服务端,以下数行代码即可实现发送预测请求,获取预测结果 -## 第二步:发送预测请求 + - ```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') -```python -import requests -import json -import cv2 -import base64 + # 发送HTTP请求 + 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(r.json()["results"]) + ``` -def cv2_to_base64(image): - data = cv2.imencode('.jpg', image)[1] - return base64.b64encode(data.tostring()).decode('utf8') +## 五、更新历史 -# 发送HTTP请求 -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)) +* 1.0.0 -# 打印预测结果 -print(r.json()["results"]) -``` - -### 查看代码 - -[PaddlePaddle/models 图像分类](https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification) - -### 依赖 - -paddlepaddle >= 1.6.2 - -paddlehub >= 1.6.0 + 初始发布 + - ```shell + $ hub install resnet50_vd_wildanimals==1.0.0 + ``` diff --git a/modules/image/classification/resnet_v2_101_imagenet/README.md b/modules/image/classification/resnet_v2_101_imagenet/README.md new file mode 100644 index 000000000..8533fb4b2 --- /dev/null +++ b/modules/image/classification/resnet_v2_101_imagenet/README.md @@ -0,0 +1,86 @@ +# resnet_v2_101_imagenet + +|模型名称|resnet_v2_101_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet V2 101| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|173MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNet系列模型是图像分类领域的重要模型之一,模型中提出的残差单元有效地解决了深度网络训练困难的问题,通过增加模型的深度提升了模型的准确率。该PaddleHub Module结构为ResNet101,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnet_v2_101_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnet_v2_101_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.0.1 + 修复python2中编码问题 + - ```shell + $ hub install resnet_v2_101_imagenet==1.0.1 + ``` diff --git a/modules/image/classification/resnet_v2_152_imagenet/README.md b/modules/image/classification/resnet_v2_152_imagenet/README.md new file mode 100644 index 000000000..f849e95ed --- /dev/null +++ b/modules/image/classification/resnet_v2_152_imagenet/README.md @@ -0,0 +1,86 @@ +# resnet_v2_152_imagenet + +|模型名称|resnet_v2_152_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet V2| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|234MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNet系列模型是图像分类领域的重要模型之一,模型中提出的残差单元有效地解决了深度网络训练困难的问题,通过增加模型的深度提升了模型的准确率。该PaddleHub Module结构为ResNet152,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnet_v2_152_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnet_v2_152_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.0.1 + 修复python2中编码问题 + - ```shell + $ hub install resnet_v2_152_imagenet==1.0.1 + ``` diff --git a/modules/image/classification/resnet_v2_18_imagenet/README.md b/modules/image/classification/resnet_v2_18_imagenet/README.md new file mode 100644 index 000000000..23a83f476 --- /dev/null +++ b/modules/image/classification/resnet_v2_18_imagenet/README.md @@ -0,0 +1,84 @@ +# resnet_v2_18_imagenet + +|模型名称|resnet_v2_18_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet V2| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|46MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNet系列模型是图像分类领域的重要模型之一,模型中提出的残差单元有效地解决了深度网络训练困难的问题,通过增加模型的深度提升了模型的准确率。该PaddleHub Module结构为ResNet18,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnet_v2_18_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnet_v2_18_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnet_v2_18_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnet_v2_34_imagenet/README.md b/modules/image/classification/resnet_v2_34_imagenet/README.md new file mode 100644 index 000000000..d8752ec5d --- /dev/null +++ b/modules/image/classification/resnet_v2_34_imagenet/README.md @@ -0,0 +1,84 @@ +# resnet_v2_34_imagenet + +|模型名称|resnet_v2_34_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet V2| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|85MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNet系列模型是图像分类领域的重要模型之一,模型中提出的残差单元有效地解决了深度网络训练困难的问题,通过增加模型的深度提升了模型的准确率。该PaddleHub Module结构为ResNet34,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnet_v2_34_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnet_v2_34_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnet_v2_34_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnet_v2_50_imagenet/README.md b/modules/image/classification/resnet_v2_50_imagenet/README.md new file mode 100644 index 000000000..3963bd759 --- /dev/null +++ b/modules/image/classification/resnet_v2_50_imagenet/README.md @@ -0,0 +1,86 @@ +# resnet_v2_50_imagenet + +|模型名称|resnet_v2_50_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNet V2| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|99MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNet系列模型是图像分类领域的重要模型之一,模型中提出的残差单元有效地解决了深度网络训练困难的问题,通过增加模型的深度提升了模型的准确率。该PaddleHub Module结构为ResNet50,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnet_v2_50_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnet_v2_50_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + +* 1.0.1 + 修复python2中编码问题 + - ```shell + $ hub install resnet_v2_50_imagenet==1.0.1 + ``` diff --git a/modules/image/classification/resnext101_32x16d_wsl/README.md b/modules/image/classification/resnext101_32x16d_wsl/README.md new file mode 100644 index 000000000..7b6501be1 --- /dev/null +++ b/modules/image/classification/resnext101_32x16d_wsl/README.md @@ -0,0 +1,84 @@ +# resnext101_32x16d_wsl + +|模型名称|resnext101_32x16d_wsl| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt_wsl| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|744MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 由于人工标注的数据集在规模上已经接近其函数极限,Facebook 的研发人员采用了一种独特的迁移学习研究,通过使用 hashtag 作为标注,在包含数十亿张社交媒体图片的数据集上进行训练,这为大规模训练转向弱监督学习(Weakly Supervised Learning) 取得了重大突破。在 ImageNet 图像识别基准上,ResNeXt101_32x16d_wsl 的 Top-1 达到了 84.24% 的准确率。该 PaddleHub Module结构为 ResNeXt101_32x16d_wsl,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext101_32x16d_wsl + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext101_32x16d_wsl --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext101_32x16d_wsl==1.0.0 + ``` diff --git a/modules/image/classification/resnext101_32x32d_wsl/README.md b/modules/image/classification/resnext101_32x32d_wsl/README.md new file mode 100644 index 000000000..f3f37f3d4 --- /dev/null +++ b/modules/image/classification/resnext101_32x32d_wsl/README.md @@ -0,0 +1,84 @@ +# resnext101_32x32d_wsl + +|模型名称|resnext101_32x32d_wsl| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt_wsl| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|1.8GB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 由于人工标注的数据集在规模上已经接近其函数极限,Facebook 的研发人员采用了一种独特的迁移学习研究,通过使用 hashtag 作为标注,在包含数十亿张社交媒体图片的数据集上进行训练,这为大规模训练转向弱监督学习(Weakly Supervised Learning) 取得了重大突破。在 ImageNet 图像识别基准上,ResNeXt101_32x32d_wsl 的 Top-1 达到了 84.97% 的准确率。该 PaddleHub Module结构为 ResNeXt101_32x32d_wsl,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext101_32x32d_wsl + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext101_32x32d_wsl --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext101_32x32d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext101_32x32d_wsl==1.0.0 + ``` diff --git a/modules/image/classification/resnext101_32x48d_wsl/README.md b/modules/image/classification/resnext101_32x48d_wsl/README.md new file mode 100644 index 000000000..24603e39a --- /dev/null +++ b/modules/image/classification/resnext101_32x48d_wsl/README.md @@ -0,0 +1,84 @@ +# resnext101_32x48d_wsl + +|模型名称|resnext101_32x48d_wsl| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt_wsl| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|342MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 由于人工标注的数据集在规模上已经接近其函数极限,Facebook 的研发人员采用了一种独特的迁移学习研究,通过使用 hashtag 作为标注,在包含数十亿张社交媒体图片的数据集上进行训练,这为大规模训练转向弱监督学习(Weakly Supervised Learning) 取得了重大突破。在 ImageNet 图像识别基准上,ResNeXt101_32x48d_wsl 的 Top-1 达到了 85.4% 的准确率。该 PaddleHub Module结构为 ResNeXt101_32x48d_wsl,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext101_32x48d_wsl + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext101_32x48d_wsl --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext101_32x48d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext101_32x48d_wsl==1.0.0 + ``` diff --git a/modules/image/classification/resnext101_32x4d_imagenet/README.md b/modules/image/classification/resnext101_32x4d_imagenet/README.md new file mode 100644 index 000000000..60a0e27f7 --- /dev/null +++ b/modules/image/classification/resnext101_32x4d_imagenet/README.md @@ -0,0 +1,85 @@ +# resnext101_32x4d_imagenet + +|模型名称|resnext101_32x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|172MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext101_32x4d,表示 layers 为 101, 分支数为 32,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext101_32x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext101_32x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext101_32x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext101_32x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext101_32x8d_wsl/README.md b/modules/image/classification/resnext101_32x8d_wsl/README.md new file mode 100644 index 000000000..94f8491dc --- /dev/null +++ b/modules/image/classification/resnext101_32x8d_wsl/README.md @@ -0,0 +1,84 @@ +# resnext101_32x8d_wsl + +|模型名称|resnext101_32x8d_wsl| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt_wsl| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|317MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 由于人工标注的数据集在规模上已经接近其函数极限,Facebook 的研发人员采用了一种独特的迁移学习研究,通过使用 hashtag 作为标注,在包含数十亿张社交媒体图片的数据集上进行训练,这为大规模训练转向弱监督学习(Weakly Supervised Learning) 取得了重大突破。在 ImageNet 图像识别基准上,ResNeXt101_32x8d_wsl 的 Top-1 达到了 82.55% 的准确率。该 PaddleHub Module结构为 ResNeXt101_32x8d_wsl,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.6.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext101_32x8d_wsl + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext101_32x8d_wsl --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext101_32x8d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext101_32x8d_wsl==1.0.0 + ``` diff --git a/modules/image/classification/resnext101_64x4d_imagenet/README.md b/modules/image/classification/resnext101_64x4d_imagenet/README.md new file mode 100644 index 000000000..588f2dbab --- /dev/null +++ b/modules/image/classification/resnext101_64x4d_imagenet/README.md @@ -0,0 +1,84 @@ +# resnext101_64x4d_imagenet + +|模型名称|resnext101_64x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|322MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext101_64x4d,表示 layers 为 101, 分支数为 64,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext101_64x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext101_64x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext101_64x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext101_64x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext101_vd_32x4d_imagenet/README.md b/modules/image/classification/resnext101_vd_32x4d_imagenet/README.md new file mode 100644 index 000000000..7c21889b7 --- /dev/null +++ b/modules/image/classification/resnext101_vd_32x4d_imagenet/README.md @@ -0,0 +1,83 @@ +# resnext101_vd_32x4d_imagenet + +|模型名称|resnext101_vd_32x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|172MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext101_vd_32x4d,表示 layers 为 101, 分支数为 32,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext101_vd_32x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext101_vd_32x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext101_vd_32x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + - ```shell + $ hub install resnext101_vd_32x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext101_vd_64x4d_imagenet/README.md b/modules/image/classification/resnext101_vd_64x4d_imagenet/README.md new file mode 100644 index 000000000..b6d6c5c02 --- /dev/null +++ b/modules/image/classification/resnext101_vd_64x4d_imagenet/README.md @@ -0,0 +1,83 @@ +# resnext101_vd_64x4d_imagenet + +|模型名称|resnext101_vd_64x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt_vd| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|172MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext101_vd_64x4d,表示 layers 为 101, 分支数为 64,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext101_vd_64x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext101_vd_64x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext101_vd_64x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + - ```shell + $ hub install resnext101_vd_64x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext152_32x4d_imagenet/README.md b/modules/image/classification/resnext152_32x4d_imagenet/README.md new file mode 100644 index 000000000..d748c6d52 --- /dev/null +++ b/modules/image/classification/resnext152_32x4d_imagenet/README.md @@ -0,0 +1,85 @@ +# resnext152_32x4d_imagenet + +|模型名称|resnext152_32x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|233MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext152_32x4d,表示 layers 为 152, 分支数为32,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext152_32x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext152_32x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext152_32x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext152_32x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext152_64x4d_imagenet/README.md b/modules/image/classification/resnext152_64x4d_imagenet/README.md new file mode 100644 index 000000000..43508a2fe --- /dev/null +++ b/modules/image/classification/resnext152_64x4d_imagenet/README.md @@ -0,0 +1,84 @@ +# resnext152_64x4d_imagenet + +|模型名称|resnext152_64x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|444MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext152_64x4d,表示 layers 为 152, 分支数为64,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext152_64x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext152_64x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext152_64x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext152_64x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext152_vd_64x4d_imagenet/README.md b/modules/image/classification/resnext152_vd_64x4d_imagenet/README.md new file mode 100644 index 000000000..537dae783 --- /dev/null +++ b/modules/image/classification/resnext152_vd_64x4d_imagenet/README.md @@ -0,0 +1,84 @@ +# resnext152_vd_64x4d_imagenet + +|模型名称|resnext152_vd_64x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt_vd| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|444MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext152_vd_64x4d,表示 layers 为 152, 分支数为64,每个分支的输入输出 channels, 并采用了 3 个 3*3 的卷积核替代 ResNeXt152_64x4d 中第一个 7*7 的卷积核。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext152_vd_64x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext152_vd_64x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext152_vd_64x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext152_vd_64x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext50_32x4d_imagenet/README.md b/modules/image/classification/resnext50_32x4d_imagenet/README.md new file mode 100644 index 000000000..474bd4cac --- /dev/null +++ b/modules/image/classification/resnext50_32x4d_imagenet/README.md @@ -0,0 +1,84 @@ +# resnext50_32x4d_imagenet + +|模型名称|resnext50_32x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|97MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext50_32x4d,表示 layers 为 50, 分支数为 32,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext50_32x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext50_32x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext50_32x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext50_32x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext50_64x4d_imagenet/README.md b/modules/image/classification/resnext50_64x4d_imagenet/README.md new file mode 100644 index 000000000..740c56812 --- /dev/null +++ b/modules/image/classification/resnext50_64x4d_imagenet/README.md @@ -0,0 +1,84 @@ +# resnext50_64x4d_imagenet + +|模型名称|resnext50_64x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|174MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext50_64x4d,表示 layers 为 50, 分支数为 64,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext50_64x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext50_64x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext50_64x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext50_64x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext50_vd_32x4d_imagenet/README.md b/modules/image/classification/resnext50_vd_32x4d_imagenet/README.md new file mode 100644 index 000000000..02e358577 --- /dev/null +++ b/modules/image/classification/resnext50_vd_32x4d_imagenet/README.md @@ -0,0 +1,84 @@ +# resnext50_vd_32x4d_imagenet + +|模型名称|resnext50_vd_32x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt_vd| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|98MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext50_vd_32x4d,表示 layers 为 50, 分支数为 32,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext50_vd_32x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext50_vd_32x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext50_vd_32x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install resnext50_vd_32x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/resnext50_vd_64x4d_imagenet/README.md b/modules/image/classification/resnext50_vd_64x4d_imagenet/README.md new file mode 100644 index 000000000..5b473b5c8 --- /dev/null +++ b/modules/image/classification/resnext50_vd_64x4d_imagenet/README.md @@ -0,0 +1,83 @@ +# resnext50_vd_64x4d_imagenet + +|模型名称|resnext50_vd_64x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ResNeXt_vd| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|175MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ResNeXt 是由 UC San Diego 和 Facebook AI 研究所于2017年提出的图像分类模型,模型沿袭了 VGG/ResNets 的堆叠思想,并采用 split-transform-merge 策略来增加网络的分支数。resnext50_vd_64x4d,表示 layers 为 50, 分支数为 64,每个分支的输入输出 channels 为4。该 PaddleHub Module 在包含数十亿张社交媒体图片的数据集上进行弱监督训练,并使用ImageNet-2012数据集finetune,接受输入图片大小为 224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install resnext50_vd_64x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run resnext50_vd_64x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="resnext50_vd_64x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + - ```shell + $ hub install resnext50_vd_64x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/se_resnet18_vd_imagenet/README.md b/modules/image/classification/se_resnet18_vd_imagenet/README.md index 2b1b1c23b..b1c11fed0 100644 --- a/modules/image/classification/se_resnet18_vd_imagenet/README.md +++ b/modules/image/classification/se_resnet18_vd_imagenet/README.md @@ -84,7 +84,7 @@ def save_inference_model(dirname, * params\_filename: 参数文件名称,默认为\_\_params\_\_(仅当`combined`为True时生效) * combined: 是否将参数保存到统一的一个文件中 -## 代码示例 +## 预测代码示例 ```python import paddlehub as hub diff --git a/modules/image/classification/se_resnext101_32x4d_imagenet/README.md b/modules/image/classification/se_resnext101_32x4d_imagenet/README.md new file mode 100644 index 000000000..1f2ac07a5 --- /dev/null +++ b/modules/image/classification/se_resnext101_32x4d_imagenet/README.md @@ -0,0 +1,84 @@ +# se_resnext101_32x4d_imagenet + +|模型名称|se_resnext101_32x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|SE_ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|191MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - Squeeze-and-Excitation Networks是由Momenta在2017年提出的一种图像分类结构。该结构通过对特征通道间的相关性进行建模,把重要的特征进行强化来提升准确率。SE_ResNeXt基于ResNeXt模型添加了SE Block,并获得了2017 ILSVR竞赛的冠军。该PaddleHub Module结构为SE_ResNeXt101_32x4d,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install se_resnext101_32x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run se_resnext101_32x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="se_resnext101_32x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install se_resnext101_32x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/se_resnext50_32x4d_imagenet/README.md b/modules/image/classification/se_resnext50_32x4d_imagenet/README.md new file mode 100644 index 000000000..05c4020f3 --- /dev/null +++ b/modules/image/classification/se_resnext50_32x4d_imagenet/README.md @@ -0,0 +1,84 @@ +# se_resnext50_32x4d_imagenet + +|模型名称|se_resnext50_32x4d_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|SE_ResNeXt| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|107MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - Squeeze-and-Excitation Networks是由Momenta在2017年提出的一种图像分类结构。该结构通过对特征通道间的相关性进行建模,把重要的特征进行强化来提升准确率。SE_ResNeXt基于ResNeXt模型添加了SE Block,并获得了2017 ILSVR竞赛的冠军。该PaddleHub Module结构为SE_ResNeXt50_32x4d,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install se_resnext50_32x4d_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run se_resnext50_32x4d_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="se_resnext50_32x4d_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install se_resnext50_32x4d_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/shufflenet_v2_imagenet/README.md b/modules/image/classification/shufflenet_v2_imagenet/README.md new file mode 100644 index 000000000..3e372c960 --- /dev/null +++ b/modules/image/classification/shufflenet_v2_imagenet/README.md @@ -0,0 +1,84 @@ +# shufflenet_v2_imagenet + +|模型名称|shufflenet_v2_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|ShuffleNet V2| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|11MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - ShuffleNet V2是由旷视科技在2018年提出的轻量级图像分类模型,该模型通过pointwise group convolution和channel shuffle两种方式,在保持精度的同时大大降低了模型的计算量。该PaddleHub Module结构为ShuffleNet V2,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install shufflenet_v2_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run shufflenet_v2_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="shufflenet_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install shufflenet_v2_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/spinalnet_res101_gemstone/README.md b/modules/image/classification/spinalnet_res101_gemstone/README.md new file mode 100644 index 000000000..bd785bda5 --- /dev/null +++ b/modules/image/classification/spinalnet_res101_gemstone/README.md @@ -0,0 +1,81 @@ +# spinalnet_res101_gemstone + +|模型名称|spinalnet_res101_gemstone| +| :--- | :---: | +|类别|图像-图像分类| +|网络|resnet101| +|数据集|gemstone| +|是否支持Fine-tuning|否| +|模型大小|246MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 使用PaddleHub的SpinalNet预训练模型进行宝石识别或finetune并完成宝石的预测任务。 +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 2.0.0 + + - paddlehub >= 2.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install spinalnet_res101_gemstone + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run spinalnet_res101_gemstone --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="spinalnet_res101_gemstone") + result = classifier.predict(['/PATH/TO/IMAGE']) + print(result) + ``` + +- ### 3、API + + - ```python + def predict(images) + ``` + - 分类接口API。 + - **参数** + - images: list类型,待预测的图像。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + - ```shell + $ hub install spinalnet_res101_gemstone==1.0.0 + ``` diff --git a/modules/image/classification/spinalnet_res50_gemstone/README.md b/modules/image/classification/spinalnet_res50_gemstone/README.md new file mode 100644 index 000000000..ed97788f7 --- /dev/null +++ b/modules/image/classification/spinalnet_res50_gemstone/README.md @@ -0,0 +1,81 @@ +# spinalnet_res50_gemstone + +|模型名称|spinalnet_res50_gemstone| +| :--- | :---: | +|类别|图像-图像分类| +|网络|resnet50| +|数据集|gemstone| +|是否支持Fine-tuning|否| +|模型大小|137MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 使用PaddleHub的SpinalNet预训练模型进行宝石识别或finetune并完成宝石的预测任务。 +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 2.0.0 + + - paddlehub >= 2.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install spinalnet_res50_gemstone + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run spinalnet_res50_gemstone --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="spinalnet_res50_gemstone") + result = classifier.predict(['/PATH/TO/IMAGE']) + print(result) + ``` + +- ### 3、API + + - ```python + def predict(images) + ``` + - 分类接口API。 + - **参数** + - images: list类型,待预测的图像。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + - ```shell + $ hub install spinalnet_res50_gemstone==1.0.0 + ``` diff --git a/modules/image/classification/spinalnet_vgg16_gemstone/README.md b/modules/image/classification/spinalnet_vgg16_gemstone/README.md new file mode 100644 index 000000000..5ca6eacd5 --- /dev/null +++ b/modules/image/classification/spinalnet_vgg16_gemstone/README.md @@ -0,0 +1,81 @@ +# spinalnet_vgg16_gemstone + +|模型名称|spinalnet_vgg16_gemstone| +| :--- | :---: | +|类别|图像-图像分类| +|网络|vgg16| +|数据集|gemstone| +|是否支持Fine-tuning|否| +|模型大小|1.5GB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - 使用PaddleHub的SpinalNet预训练模型进行宝石识别或finetune并完成宝石的预测任务。 +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 2.0.0 + + - paddlehub >= 2.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install spinalnet_vgg16_gemstone + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run spinalnet_vgg16_gemstone --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="spinalnet_vgg16_gemstone") + result = classifier.predict(['/PATH/TO/IMAGE']) + print(result) + ``` + +- ### 3、API + + - ```python + def predict(images) + ``` + - 分类接口API。 + - **参数** + - images: list类型,待预测的图像。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + - ```shell + $ hub install spinalnet_vgg16_gemstone==1.0.0 + ``` diff --git a/modules/image/classification/vgg11_imagenet/README.md b/modules/image/classification/vgg11_imagenet/README.md new file mode 100644 index 000000000..290588351 --- /dev/null +++ b/modules/image/classification/vgg11_imagenet/README.md @@ -0,0 +1,84 @@ +# vgg11_imagenet + +|模型名称|vgg11_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|VGG| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|507MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - VGG是牛津大学计算机视觉组和DeepMind在2014年提出的一种图像分类模型。该系列模型探索了卷积神经网络的深度与其性能之间的关系,通过实验证明了增加网络的深度能够在一定程度上影响网络最终的性能,到目前为止,VGG仍然被许多其他图像任务用作特征提取的BackBone网络。该PaddleHub Module结构为VGG11,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install vgg11_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run vgg11_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="vgg11_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install vgg11_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/vgg13_imagenet/README.md b/modules/image/classification/vgg13_imagenet/README.md new file mode 100644 index 000000000..2f967b7f1 --- /dev/null +++ b/modules/image/classification/vgg13_imagenet/README.md @@ -0,0 +1,84 @@ +# vgg13_imagenet + +|模型名称|vgg13_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|VGG| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|508MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - VGG是牛津大学计算机视觉组和DeepMind在2014年提出的一种图像分类模型。该系列模型探索了卷积神经网络的深度与其性能之间的关系,通过实验证明了增加网络的深度能够在一定程度上影响网络最终的性能,到目前为止,VGG仍然被许多其他图像任务用作特征提取的BackBone网络。该PaddleHub Module结构为VGG13,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install vgg13_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run vgg13_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="vgg13_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install vgg13_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/vgg16_imagenet/README.md b/modules/image/classification/vgg16_imagenet/README.md new file mode 100644 index 000000000..14186cec2 --- /dev/null +++ b/modules/image/classification/vgg16_imagenet/README.md @@ -0,0 +1,84 @@ +# vgg16_imagenet + +|模型名称|vgg16_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|VGG| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|528MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - VGG是牛津大学计算机视觉组和DeepMind在2014年提出的一种图像分类模型。该系列模型探索了卷积神经网络的深度与其性能之间的关系,通过实验证明了增加网络的深度能够在一定程度上影响网络最终的性能,到目前为止,VGG仍然被许多其他图像任务用作特征提取的BackBone网络。该PaddleHub Module结构为VGG16,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install vgg16_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run vgg16_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="vgg16_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install vgg16_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/vgg19_imagenet/README.md b/modules/image/classification/vgg19_imagenet/README.md new file mode 100644 index 000000000..3ecf4e2bf --- /dev/null +++ b/modules/image/classification/vgg19_imagenet/README.md @@ -0,0 +1,84 @@ +# vgg19_imagenet + +|模型名称|vgg19_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|vgg19_imagenet| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|549MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - VGG是牛津大学计算机视觉组和DeepMind在2014年提出的一种图像分类模型。该系列模型探索了卷积神经网络的深度与其性能之间的关系,通过实验证明了增加网络的深度能够在一定程度上影响网络最终的性能,到目前为止,VGG仍然被许多其他图像任务用作特征提取的BackBone网络。该PaddleHub Module结构为VGG19,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者Python接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install vgg19_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run vgg19_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="vgg19_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install vgg19_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/xception41_imagenet/README.md b/modules/image/classification/xception41_imagenet/README.md new file mode 100644 index 000000000..a5ad52074 --- /dev/null +++ b/modules/image/classification/xception41_imagenet/README.md @@ -0,0 +1,84 @@ +# xception41_imagenet + +|模型名称|xception41_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|Xception| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - Xception 全称为 Extreme Inception,是 Google 于 2016年提出的 Inception V3 的改进模型。Xception 采用了深度可分离卷积(depthwise separable convolution) 来替换原来 Inception V3 中的卷积操作,整体的网络结构是带有残差连接的深度可分离卷积层的线性堆叠。该PaddleHub Module结构为Xception41,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install xception41_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run xception41_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="xception41_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install xception41_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/xception65_imagenet/README.md b/modules/image/classification/xception65_imagenet/README.md new file mode 100644 index 000000000..1be8b866e --- /dev/null +++ b/modules/image/classification/xception65_imagenet/README.md @@ -0,0 +1,84 @@ +# xception65_imagenet + +|模型名称|xception65_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|Xception| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|140MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - Xception 全称为 Extreme Inception,是 Google 于 2016年提出的 Inception V3 的改进模型。Xception 采用了深度可分离卷积(depthwise separable convolution) 来替换原来 Inception V3 中的卷积操作,整体的网络结构是带有残差连接的深度可分离卷积层的线性堆叠。该PaddleHub Module结构为Xception65,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install xception65_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run xception65_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="xception65_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install xception65_imagenet==1.0.0 + ``` diff --git a/modules/image/classification/xception71_imagenet/README.md b/modules/image/classification/xception71_imagenet/README.md new file mode 100644 index 000000000..28f44f916 --- /dev/null +++ b/modules/image/classification/xception71_imagenet/README.md @@ -0,0 +1,84 @@ +# xception71_imagenet + +|模型名称|xception71_imagenet| +| :--- | :---: | +|类别|图像-图像分类| +|网络|Xception| +|数据集|ImageNet-2012| +|是否支持Fine-tuning|否| +|模型大小|147MB| +|最新更新日期|-| +|数据指标|-| + + +## 一、模型基本信息 + + + +- ### 模型介绍 + + - Xception 全称为 Extreme Inception,是 Google 于 2016年提出的 Inception V3 的改进模型。Xception 采用了深度可分离卷积(depthwise separable convolution) 来替换原来 Inception V3 中的卷积操作,整体的网络结构是带有残差连接的深度可分离卷积层的线性堆叠。该PaddleHub Module结构为Xception71,基于ImageNet-2012数据集训练,接受输入图片大小为224 x 224 x 3,支持直接通过命令行或者 Python 接口进行预测。 + +## 二、安装 + +- ### 1、环境依赖 + + - paddlepaddle >= 1.4.0 + + - paddlehub >= 1.0.0 | [如何安装paddlehub](../../../../docs/docs_ch/get_start/installation.rst) + + +- ### 2、安装 + + - ```shell + $ hub install xception71_imagenet + ``` + - 如您安装时遇到问题,可参考:[零基础windows安装](../../../../docs/docs_ch/get_start/windows_quickstart.md) + | [零基础Linux安装](../../../../docs/docs_ch/get_start/linux_quickstart.md) | [零基础MacOS安装](../../../../docs/docs_ch/get_start/mac_quickstart.md) + +## 三、模型API预测 + +- ### 1、命令行预测 + + - ```shell + $ hub run xception71_imagenet --input_path "/PATH/TO/IMAGE" + ``` + - 通过命令行方式实现图像分类模型的调用,更多请见 [PaddleHub命令行指令](../../../../docs/docs_ch/tutorial/cmd_usage.rst) + +- ### 2、预测代码示例 + + - ```python + import paddlehub as hub + import cv2 + + classifier = hub.Module(name="xception71_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) + ``` + - 分类接口API。 + - **参数** + - data:dict类型,key为image,str类型,value为待检测的图片路径,list类型。 + + - **返回** + - result:list类型,每个元素为对应输入图片的预测结果。预测结果为dict类型,key为该图片分类结果label,value为该label对应的概率 + + + + + +## 四、更新历史 + +* 1.0.0 + + 初始发布 + + - ```shell + $ hub install xception71_imagenet==1.0.0 + ```