Skip to content

Commit

Permalink
Update image classification docs (#1652)
Browse files Browse the repository at this point in the history
  • Loading branch information
rainyfly authored Nov 12, 2021
1 parent fd4fb4d commit be73bfb
Show file tree
Hide file tree
Showing 80 changed files with 6,983 additions and 951 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
| :--- | :---: |
|类别|图像 - 图像生成|
|网络|AnimeGAN|
|数据集|The Wind Rises|
|数据集|Paprika|
|是否支持Fine-tuning||
|模型大小|9.4MB|
|最新更新日期|2021-07-30|
|最新更新日期|2021-02-26|
|数据指标|-|


Expand All @@ -16,21 +16,20 @@
- ### 应用效果展示
- 样例结果示例:
<p align="center">
<img src="https://user-images.githubusercontent.com/35907364/136652269-48b8c902-3a2b-46b7-a9f2-d500097bbb0e.jpg" width = "450" height = "300" hspace='10'/>
<br />
<img src="https://ai-studio-static-online.cdn.bcebos.com/bd002c4bb6a7427daf26988770bb18648b7d8d2bfd6746bfb9a429db4867727f" width = "450" height = "300" hspace='10'/>
<br />
输入图像
<br />
<img src="https://user-images.githubusercontent.com/35907364/136653120-e081cd59-bc2b-4a91-a437-3a7d478e0763.jpg" width = "450" height = "300" hspace='10'/>
<br />
<br />
<img src="https://ai-studio-static-online.cdn.bcebos.com/6574669d87b24bab9627c6e33896528b4a0bf5af1cd84ca29655d68719f2d551" width = "450" height = "300" hspace='10'/>
<br />
输出图像
<br />
</p>



- ### 模型介绍

- AnimeGAN V2 图像风格转换模型, 模型可将输入的图像转换成宫崎骏动漫风格,模型权重转换自[AnimeGAN V2官方开源项目](https://github.com/TachibanaYoshino/AnimeGAN)
- AnimeGAN V2 图像风格转换模型, 模型可将输入的图像转换成今敏红辣椒动漫风格,模型权重转换自[AnimeGAN V2官方开源项目](https://github.com/TachibanaYoshino/AnimeGANv2)


## 二、安装
Expand Down Expand Up @@ -81,12 +80,10 @@
- images (list\[numpy.ndarray\]): 图片数据,ndarray.shape 为 \[H, W, C\]<br/>
- paths (list\[str\]): 图片的路径;<br/>
- output\_dir (str): 图片的保存路径,默认设为 output;<br/>
- visualization (bool): 是否将识别结果保存为图片文件<br/>
- visualization (bool): 是否将结果保存为图片文件<br/>
- min\_size (int): 输入图片的短边最小尺寸,默认设为 32;<br/>
- max\_size (int): 输入图片的短边最大尺寸,默认设为 1024。

**NOTE:** paths和images两个参数选择其一进行提供数据

- **返回**
- res (list\[numpy.ndarray\]): 输出图像数据,ndarray.shape 为 \[H, W, C\]

Expand Down Expand Up @@ -145,3 +142,7 @@
* 1.0.2

删除batch_size选项

- ```shell
$ hub install animegan_v2_paprika_54==1.0.2
```
155 changes: 90 additions & 65 deletions modules/image/classification/DriverStatusRecognition/README.md
Original file line number Diff line number Diff line change
@@ -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
~~~

# 效果展示

## 原图
<img src="/docs/imgs/Readme_Related/Image_Classification_Drivers.png">

## 输出结果
~~~
[{'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<br>
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
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
paddlex==1.3.7
chardet
154 changes: 90 additions & 64 deletions modules/image/classification/SnakeIdentification/README.md
Original file line number Diff line number Diff line change
@@ -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
~~~

# 效果展示

## 原图
<img src="/docs/imgs/Readme_Related/Image_Classification_Snake.png">

## 输出结果
~~~
[{'category_id': 0, 'category': '水蛇', 'score': 0.9999205}]
~~~

# 贡献者
郑博培、彭兆帅

# 依赖
paddlepaddle >= 2.0.0<br>
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
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
paddlex==1.3.7
Loading

0 comments on commit be73bfb

Please sign in to comment.