Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
c43146f1
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
1 年多 前同步成功
通知
116
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c43146f1
编写于
6月 12, 2022
作者:
W
Wei Shengyu
提交者:
GitHub
6月 12, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'PaddlePaddle:develop' into develop
上级
5b807c1b
f70c566b
变更
38
隐藏空白更改
内联
并排
Showing
38 changed file
with
230 addition
and
66 deletion
+230
-66
README_ch.md
README_ch.md
+6
-11
deploy/configs/PULC/language_classification/inference_language_classification.yaml
...age_classification/inference_language_classification.yaml
+1
-1
deploy/configs/PULC/text_image_orientation/inference_text_image_orientation.yaml
...t_image_orientation/inference_text_image_orientation.yaml
+1
-1
deploy/configs/PULC/textline_orientation/inference_textline_orientation.yaml
.../textline_orientation/inference_textline_orientation.yaml
+1
-1
deploy/configs/PULC/vehicle_exists/inference_vehicle_exists.yaml
...configs/PULC/vehicle_exists/inference_vehicle_exists.yaml
+36
-0
deploy/images/PULC/vehicle_exists/objects365_00001507.jpeg
deploy/images/PULC/vehicle_exists/objects365_00001507.jpeg
+0
-0
deploy/images/PULC/vehicle_exists/objects365_00001521.jpeg
deploy/images/PULC/vehicle_exists/objects365_00001521.jpeg
+0
-0
docs/zh_CN/PULC/PULC_language_classification.md
docs/zh_CN/PULC/PULC_language_classification.md
+7
-7
docs/zh_CN/PULC/PULC_model_list.md
docs/zh_CN/PULC/PULC_model_list.md
+25
-0
docs/zh_CN/PULC/PULC_quickstart.md
docs/zh_CN/PULC/PULC_quickstart.md
+111
-0
docs/zh_CN/PULC/PULC_text_image_orientation.md
docs/zh_CN/PULC/PULC_text_image_orientation.md
+4
-5
docs/zh_CN/PULC/PULC_traffic_sign.md
docs/zh_CN/PULC/PULC_traffic_sign.md
+4
-4
docs/zh_CN/PULC/PULC_vehicle_attribute.md
docs/zh_CN/PULC/PULC_vehicle_attribute.md
+7
-7
paddleclas.py
paddleclas.py
+4
-2
ppcls/configs/PULC/language_classification/MobileNetV3_small_x0_35.yaml
...PULC/language_classification/MobileNetV3_small_x0_35.yaml
+1
-1
ppcls/configs/PULC/language_classification/PPLCNet_x1_0.yaml
ppcls/configs/PULC/language_classification/PPLCNet_x1_0.yaml
+1
-1
ppcls/configs/PULC/language_classification/PPLCNet_x1_0_distillation.yaml
...LC/language_classification/PPLCNet_x1_0_distillation.yaml
+2
-2
ppcls/configs/PULC/language_classification/PPLCNet_x1_0_search.yaml
...igs/PULC/language_classification/PPLCNet_x1_0_search.yaml
+1
-1
ppcls/configs/PULC/language_classification/SwinTransformer_tiny_patch4_window7_224.yaml
...assification/SwinTransformer_tiny_patch4_window7_224.yaml
+1
-1
ppcls/configs/PULC/text_image_orientation/MobileNetV3_small_x0_35.yaml
.../PULC/text_image_orientation/MobileNetV3_small_x0_35.yaml
+1
-1
ppcls/configs/PULC/text_image_orientation/PPLCNet_x1_0.yaml
ppcls/configs/PULC/text_image_orientation/PPLCNet_x1_0.yaml
+1
-1
ppcls/configs/PULC/text_image_orientation/PPLCNet_x1_0_distillation.yaml
...ULC/text_image_orientation/PPLCNet_x1_0_distillation.yaml
+2
-2
ppcls/configs/PULC/text_image_orientation/PPLCNet_x1_0_search.yaml
...figs/PULC/text_image_orientation/PPLCNet_x1_0_search.yaml
+1
-1
ppcls/configs/PULC/text_image_orientation/SwinTransformer_tiny_patch4_window7_224.yaml
..._orientation/SwinTransformer_tiny_patch4_window7_224.yaml
+1
-1
ppcls/configs/PULC/textline_orientation/MobileNetV3_small_x0_35.yaml
...gs/PULC/textline_orientation/MobileNetV3_small_x0_35.yaml
+1
-1
ppcls/configs/PULC/textline_orientation/PPLCNet_x1_0.yaml
ppcls/configs/PULC/textline_orientation/PPLCNet_x1_0.yaml
+1
-1
ppcls/configs/PULC/textline_orientation/PPLCNet_x1_0_224x224.yaml
...nfigs/PULC/textline_orientation/PPLCNet_x1_0_224x224.yaml
+1
-1
ppcls/configs/PULC/textline_orientation/PPLCNet_x1_0_distillation.yaml
.../PULC/textline_orientation/PPLCNet_x1_0_distillation.yaml
+1
-1
ppcls/configs/PULC/textline_orientation/PPLCNet_x1_0_search.yaml
...onfigs/PULC/textline_orientation/PPLCNet_x1_0_search.yaml
+1
-1
ppcls/configs/PULC/textline_orientation/SwinTransformer_tiny_patch4_window7_224.yaml
..._orientation/SwinTransformer_tiny_patch4_window7_224.yaml
+1
-1
ppcls/configs/PULC/traffic_sign/MobileNetV3_samll_x0_35.yaml
ppcls/configs/PULC/traffic_sign/MobileNetV3_samll_x0_35.yaml
+1
-1
ppcls/configs/PULC/traffic_sign/PPLCNet_x1_0.yaml
ppcls/configs/PULC/traffic_sign/PPLCNet_x1_0.yaml
+1
-1
ppcls/configs/PULC/traffic_sign/PPLCNet_x1_0_distillation.yaml
.../configs/PULC/traffic_sign/PPLCNet_x1_0_distillation.yaml
+1
-1
ppcls/configs/PULC/traffic_sign/PPLCNet_x1_0_search.yaml
ppcls/configs/PULC/traffic_sign/PPLCNet_x1_0_search.yaml
+1
-1
ppcls/configs/PULC/traffic_sign/SwinTransformer_tiny_patch4_window7_224.yaml
...traffic_sign/SwinTransformer_tiny_patch4_window7_224.yaml
+1
-1
ppcls/utils/PULC/text_image_orientation_label_list.txt
ppcls/utils/PULC/text_image_orientation_label_list.txt
+0
-4
ppcls/utils/PULC_label_list/language_classification_label_list.txt
...ls/PULC_label_list/language_classification_label_list.txt
+0
-0
ppcls/utils/PULC_label_list/textline_orientation_label_list.txt
...utils/PULC_label_list/textline_orientation_label_list.txt
+0
-0
未找到文件。
README_ch.md
浏览文件 @
c43146f1
...
...
@@ -25,13 +25,8 @@ PP-ShiTu图像识别系统效果展示
-
🔥️ 2022.6.15 发布PULC超轻量图像分类方案,CPU推理3ms,精度比肩SwinTransformer,覆盖人、车、OCR场景九大常见任务。
-
2022.5.26
[
飞桨产业实践范例直播课
](
http://aglc.cn/v-c4FAR
)
,解读
**超轻量重点区域人员出入管理方案**
。
-
2022.5.23 新增
[
人员出入管理范例库
](
https://aistudio.baidu.com/aistudio/projectdetail/4094475
)
,具体内容可以在 AI Stuio 上体验。
-
2022.5.20 上线
[
PP-HGNet
](
./docs/zh_CN/models/PP-HGNet.md
)
,
[
PP-LCNet
v2
](
./docs/zh_CN/models/PP-LCNetV2.md
)
。
-
2022.5.20 上线
[
PP-HGNet
](
./docs/zh_CN/models/PP-HGNet.md
)
,
[
PP-LCNetv2
](
./docs/zh_CN/models/PP-LCNetV2.md
)
。
-
2022.4.21 新增 CVPR2022 oral论文
[
MixFormer
](
https://arxiv.org/pdf/2204.02557.pdf
)
相关
[
代码
](
https://github.com/PaddlePaddle/PaddleClas/pull/1820/files
)
。
-
2022.1.27 全面升级文档;新增
[
PaddleServing C++ pipeline部署方式
](
./deploy/paddleserving
)
和
[
18M图像识别安卓部署Demo
](
./deploy/lite_shitu
)
。
-
2021.11.1 发布
[
PP-ShiTu技术报告
](
https://arxiv.org/pdf/2111.00775.pdf
)
,新增饮料识别demo。
-
2021.10.23 发布轻量级图像识别系统PP-ShiTu,CPU上0.2s即可完成在10w+库的图像识别。
[
点击这里
](
./docs/zh_CN/quick_start/quick_start_recognition.md
)
立即体验。
-
2021.09.17 发布PP-LCNet系列超轻量骨干网络模型, 在Intel CPU上,单张图像预测速度约5ms,ImageNet-1K数据集上Top1识别准确率达到80.82%,超越ResNet152的模型效果。PP-LCNet的介绍可以参考
[
论文
](
https://arxiv.org/pdf/2109.15099.pdf
)
, 或者
[
PP-LCNet模型介绍
](
docs/zh_CN/models/PP-LCNet.md
)
,相关指标和预训练权重可以从
[
这里
](
docs/zh_CN/algorithm_introduction/ImageNet_models.md
)
下载。
-
[
more
](
./docs/zh_CN/others/update_history.md
)
## 特性
...
...
@@ -51,16 +46,16 @@ PP-ShiTu图像识别系统效果展示
## 快速体验
PULC超轻量图像分类方案快速体验:
[
点击这里
](
docs/zh_CN/PULC/PULC_
person_exists.md
)
。
PULC超轻量图像分类方案快速体验:
[
点击这里
](
docs/zh_CN/PULC/PULC_
quickstart.md
)
PP-ShiTu图像识别快速体验:
[
点击这里
](
./docs/zh_CN/quick_start/quick_start_recognition.md
)
。
PP-ShiTu图像识别快速体验:
[
点击这里
](
./docs/zh_CN/quick_start/quick_start_recognition.md
)
## 文档教程
-
[
环境准备
](
docs/zh_CN/installation/install_paddleclas.md
)
-
PULC超轻量图像分类实用方案 文档更新中
-
超轻量图像分类模型库 文档更新中
-
[
超轻量图像分类模型库
](
docs/zh_CN/installation/PULC_model_list.md
)
-
[
PULC有人/无人分类模型
](
docs/zh_CN/PULC/PULC_person_exists.md
)
-
PULC人体属性识别模型 文档更新中
-
[
PULC人体属性识别模型
](
docs/zh_CN/PULC/PULC_person_attribute.md
)
-
[
PULC佩戴安全帽分类模型
](
docs/zh_CN/PULC/PULC_safety_helmet.md
)
-
[
PULC交通标志分类模型
](
docs/zh_CN/PULC/PULC_traffic_sign.md
)
-
[
PULC车辆属性识别模型
](
docs/zh_CN/PULC/PULC_vehicle_attribute.md
)
...
...
@@ -92,7 +87,7 @@ PP-ShiTu图像识别快速体验:[点击这里](./docs/zh_CN/quick_start/quick
-
模型压缩 文档更新中
-
PP系列骨干网络模型
-
[
PP-HGNet
](
docs/zh_CN/models/PP-HGNet.md
)
-
[
PP-LCNet
v2
](
docs/zh_CN/models/PP-LCNetV2.md
)
-
[
PP-LCNetv2
](
docs/zh_CN/models/PP-LCNetV2.md
)
-
[
PP-LCNet
](
docs/zh_CN/models/PP-LCNet.md
)
-
[
SSLD半监督知识蒸馏方案
](
docs/zh_CN/advanced_tutorials/ssld.md
)
-
前沿算法
...
...
deploy/configs/PULC/language_classification/inference_language_classification.yaml
浏览文件 @
c43146f1
...
...
@@ -28,6 +28,6 @@ PostProcess:
main_indicator
:
Topk
Topk
:
topk
:
2
class_id_map_file
:
"
../
dataset/language_classification/
label_list.txt"
class_id_map_file
:
"
../
ppcls/utils/PULC_label_list/language_classification_
label_list.txt"
SavePreLabel
:
save_dir
:
./pre_label/
deploy/configs/PULC/text_image_orientation/inference_text_image_orientation.yaml
浏览文件 @
c43146f1
...
...
@@ -30,6 +30,6 @@ PostProcess:
main_indicator
:
Topk
Topk
:
topk
:
2
class_id_map_file
:
"
../
dataset/text_image_orientation/
label_list.txt"
class_id_map_file
:
"
../
ppcls/utils/PULC_label_list/text_image_orientation_
label_list.txt"
SavePreLabel
:
save_dir
:
./pre_label/
deploy/configs/PULC/textline_orientation/inference_textline_orientation.yaml
浏览文件 @
c43146f1
...
...
@@ -28,6 +28,6 @@ PostProcess:
main_indicator
:
Topk
Topk
:
topk
:
1
class_id_map_file
:
"
../ppcls/utils/PULC/textline_orientation_label_list.txt"
class_id_map_file
:
"
../ppcls/utils/PULC
_label_list
/textline_orientation_label_list.txt"
SavePreLabel
:
save_dir
:
./pre_label/
deploy/configs/PULC/vehicle_exists/inference_vehicle_exists.yaml
0 → 100644
浏览文件 @
c43146f1
Global
:
infer_imgs
:
"
./images/PULC/vehicle_exists/objects365_00001507.jpeg"
inference_model_dir
:
"
./models/vehicle_exists_infer"
batch_size
:
1
use_gpu
:
True
enable_mkldnn
:
False
cpu_num_threads
:
10
enable_benchmark
:
True
use_fp16
:
False
ir_optim
:
True
use_tensorrt
:
False
gpu_mem
:
8000
enable_profile
:
False
PreProcess
:
transform_ops
:
-
ResizeImage
:
resize_short
:
256
-
CropImage
:
size
:
224
-
NormalizeImage
:
scale
:
0.00392157
mean
:
[
0.485
,
0.456
,
0.406
]
std
:
[
0.229
,
0.224
,
0.225
]
order
:
'
'
channel_num
:
3
-
ToCHWImage
:
PostProcess
:
main_indicator
:
ThreshOutput
ThreshOutput
:
threshold
:
0.5
label_0
:
no_vehicle
label_1
:
contains_vehicle
SavePreLabel
:
save_dir
:
./pre_label/
deploy/images/PULC/vehicle_exists/objects365_00001507.jpeg
0 → 100644
浏览文件 @
c43146f1
157.1 KB
deploy/images/PULC/vehicle_exists/objects365_00001521.jpeg
0 → 100644
浏览文件 @
c43146f1
178.0 KB
docs/zh_CN/PULC/PULC_language_classification.md
浏览文件 @
c43146f1
# PULC语种分类模型
# PULC
语种分类模型
## 目录
-
[
1.
模型和应用场景介绍
](
#1
)
-
[
2.
模型快速体验
](
#2
)
-
[
1. 模型和应用场景介绍
](
#1
)
-
[
2. 模型快速体验
](
#2
)
-
[
2.1 安装 paddleclas
](
#2.1
)
-
[
2.2 预测
](
#2.2
)
-
[
3.
模型训练、评估和预测
](
#3
)
-
[
3. 模型训练、评估和预测
](
#3
)
-
[
3.1 环境配置
](
#3.1
)
-
[
3.2 数据准备
](
#3.2
)
-
[
3.2.1 数据集来源
](
#3.2.1
)
...
...
@@ -73,14 +73,14 @@ pip3 install paddleclas
-
使用命令行快速预测
```
paddleclas --model_name=language_classification --infer_imgs=deploy/images/PULC/language_classification/
img_rot0_demo.jp
g
paddleclas --model_name=language_classification --infer_imgs=deploy/images/PULC/language_classification/
word_35404.pn
g
```
结果如下:
```
>>> result
class_ids: [4,
9], scores: [0.96809, 0.01001], label_names: ['japan', 'lati
n'], filename: deploy/images/PULC/language_classification/word_35404.png
class_ids: [4,
6], scores: [0.88672, 0.01434], label_names: ['japan', 'korea
n'], filename: deploy/images/PULC/language_classification/word_35404.png
Predict complete!
```
...
...
@@ -99,7 +99,7 @@ print(next(result))
```
>>> result
[{'class_ids': [4,
9], 'scores': [0.96809, 0.01001], 'label_names': ['japan', 'latin'], 'filename': '
deploy/images/PULC/language_classification/word_35404.png'}]
[{'class_ids': [4,
6], 'scores': [0.88672, 0.01434], 'label_names': ['japan', 'korean'], 'filename': '/
deploy/images/PULC/language_classification/word_35404.png'}]
```
<a
name=
"3"
></a>
...
...
docs/zh_CN/PULC/PULC_model_list.md
0 → 100644
浏览文件 @
c43146f1
# PULC 模型库
------
此处提供了 PULC 模型库的相关指标和模型的下载链接,其中预训练模型可以用来微调训练,推理模型可以直接用来预测和部署。
|模型名称|模型简介|模型精度 |模型大小|推理耗时|下载地址|
| --- | --- | --- | --- | --- | --- |
| person_exists |
[
PULC有人/无人分类模型
](
PULC_person_exists.md
)
| 95.60 |6.5M|2.58ms|
[
推理模型
](
https://paddleclas.bj.bcebos.com/models/PULC/inference/person_exists_infer.tar
)
/
[
预训练模型
](
https://paddleclas.bj.bcebos.com/models/PULC/pretrained/person_exists_pretrained.pdparams
)
|
| person_attribute |
[
PULC人体属性识别模型
](
PULC_person_attribute.md
)
| 78.59 |6.6M|2.01ms|
[
推理模型
](
https://paddleclas.bj.bcebos.com/models/PULC/inference/person_attribute_infer.tar
)
/
[
预训练模型
](
https://paddleclas.bj.bcebos.com/models/PULC/pretrained/person_attribute_pretrained.pdparams
)
|
| safety_helmet |
[
PULC佩戴安全帽分类模型
](
PULC_safety_helmet.md
)
| 99.38 |6.5M|2.03ms|
[
推理模型
](
https://paddleclas.bj.bcebos.com/models/PULC/inference/safety_helmet_infer.tar
)
/
[
预训练模型
](
https://paddleclas.bj.bcebos.com/models/PULC/pretrained/safety_helmet_pretrained.pdparams
)
|
| traffic_sign |
[
PULC交通标志分类模型
](
PULC_traffic_sign.md
)
| 98.35 |8.2M|2.10ms|
[
推理模型
](
https://paddleclas.bj.bcebos.com/models/PULC/inference/traffic_sign_infer.tar
)
/
[
预训练模型
](
https://paddleclas.bj.bcebos.com/models/PULC/pretrained/traffic_sign_pretrained.pdparams
)
|
| vehicle_attribute |
[
PULC车辆属性识别模型
](
PULC_vehicle_attribute.md
)
| 90.81 |7.2M|2.36ms|
[
推理模型
](
https://paddleclas.bj.bcebos.com/models/PULC/inference/vehicle_attribute_infer.tar
)
/
[
预训练模型
](
https://paddleclas.bj.bcebos.com/models/PULC/pretrained/vehicle_attribute_pretrained.pdparams
)
|
| vehicle_exists |PULC有车/无车分类模型 | 95.72 | 6.6M | 2.38ms |
[
推理模型
](
https://paddleclas.bj.bcebos.com/models/PULC/inference/vehicle_exists_infer.tar
)
/
[
预训练模型
](
https://paddleclas.bj.bcebos.com/models/PULC/pretrained/vehicle_exists_pretrained.pdparams
)
|
| text_image_orientation |
[
PULC含文字图像方向分类模型
](
PULC_text_image_orientation.md
)
| 99.06 | 6.5M | 2.16ms |
[
推理模型
](
https://paddleclas.bj.bcebos.com/models/PULC/inference/text_image_orientation_infer.tar
)
/
[
预训练模型
](
https://paddleclas.bj.bcebos.com/models/PULC/pretrained/text_image_orientation_pretrained.pdparams
)
|
| textline_orientation |
[
PULC文本行方向分类模型
](
PULC_textline_orientation.md
)
| 96.01 |6.5M|2.72ms|
[
推理模型
](
https://paddleclas.bj.bcebos.com/models/PULC/inference/textline_orientation_infer.tar
)
/
[
预训练模型
](
https://paddleclas.bj.bcebos.com/models/PULC/pretrained/textline_orientation_pretrained.pdparams
)
|
| language_classification |
[
PULC语种分类模型
](
PULC_language_classification.md
)
| 99.26 |6.5M|2.58ms|
[
推理模型
](
https://paddleclas.bj.bcebos.com/models/PULC/inference/language_classification_infer.tar
)
/
[
预训练模型
](
https://paddleclas.bj.bcebos.com/models/PULC/pretrained/language_classification_pretrained.pdparams
)
|
**备注:**
*
以上所有的模型的 backbone 均为 PPLCNet_x1_0,部分模型大小不同是由于分类的输出大小不同导致的,推理耗时是基于Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz 测试得到,其中测试过程开启 MKLDNN 加速策略,线程数为10。速度测试过程会有轻微波动。
*
person_exists、safety_helmet、vehicle_exists 的评测指标为 TprAtFpr,person_attribute、vehicle_attribute的评测指标为ma、traffic_sign、text_image_orientation、textline_orientation、language_classification的评测指标为Top-1 Acc。
\ No newline at end of file
docs/zh_CN/PULC/PULC_quickstart.md
0 → 100644
浏览文件 @
c43146f1
# PULC 快速体验
------
本文主要介绍PaddleClas whl包对 PULC 系列模型的快速使用。
## 目录
-
[
1. 安装
](
#1
)
-
[
1.1 安装PaddlePaddle
](
#11
)
-
[
1.2 安装PaddleClas whl包
](
#12
)
-
[
2. 快速体验
](
#2
)
-
[
2.1 命令行使用
](
#2.1
)
-
[
2.2 Python脚本使用
](
#2.2
)
-
[
3.小结
](
#3
)
<a
name=
"1"
></a>
## 1. 安装
<a
name=
"1.1"
></a>
### 1.1 安装 PaddlePaddle
-
您的机器安装的是 CUDA9 或 CUDA10,请运行以下命令安装
```
bash
python3
-m
pip
install
paddlepaddle-gpu
-i
https://mirror.baidu.com/pypi/simple
```
-
您的机器是CPU,请运行以下命令安装
```
bash
python3
-m
pip
install
paddlepaddle
-i
https://mirror.baidu.com/pypi/simple
```
更多的版本需求,请参照
[
飞桨官网安装文档
](
https://www.paddlepaddle.org.cn/install/quick
)
中的说明进行操作。
<a
name=
"1.2"
></a>
### 1.2 安装 PaddleClas whl 包
```
bash
pip
install
paddleclas
```
<a
name=
"2"
></a>
## 2. 快速体验
PaddleClas 提供了一系列测试图片,里边包含人、车、OCR等方向的多个场景大的demo数据。点击
[
这里
](
https://paddleclas.bj.bcebos.com/data/PULC/pulc_demo_imgs.zip
)
下载并解压,然后在终端中切换到相应目录。
<a
name=
"2.1"
></a>
### 2.1 命令行使用
```
cd /path/to/pulc_demo_imgs
```
使用命令行预测:
```
bash
paddleclas
--model_name
=
person_exists
--infer_imgs
=
pulc_demo_imgs/person_exists/objects365_01780782.jpg
```
结果如下:
```
>>> result
class_ids: [0], scores: [0.9955421453341842], label_names: ['nobody'], filename: pulc_demo_imgs/person_exists/objects365_01780782.jpg
Predict complete!
```
若预测结果为
`nobody`
,表示该图中没有人,若预测结果为
`someone`
,则表示该图中有人。此处预测结果为
`nobody`
,表示该图中没有人。
**备注**
: 更换其他预测的数据时,只需要改变
`--infer_imgs=xx`
中的字段即可,支持传入整个文件夹,如需要替换模型,更改
`--model_name`
中的模型名字即可,模型名字可以参考
[
模型库
](
./PULC_model_list.md
)
。
<a
name=
"2.2"
></a>
### 2.2 Python 脚本使用
此处提供了在 python 脚本中使用 PULC 有人/无人分类模型预测的例子。
```
python
import
paddleclas
model
=
paddleclas
.
PaddleClas
(
model_name
=
"person_exists"
)
result
=
model
.
predict
(
input_data
=
"pulc_demo_imgs/person_exists/objects365_01780782.jpg"
)
print
(
next
(
result
))
```
打印的结果如下:
```
>>> result
[{'class_ids': [0], 'scores': [0.9955421453341842], 'label_names': ['nobody'], 'filename': 'pulc_demo_imgs/person_exists/objects365_01780782.jpg'}]
```
**备注**
:
`model.predict()`
为可迭代对象(
`generator`
),因此需要使用
`next()`
函数或
`for`
循环对其迭代调用。每次调用将以
`batch_size`
为单位进行一次预测,并返回预测结果, 默认
`batch_size`
为 1,如果需要更改
`batch_size`
,实例化模型时,需要指定
`batch_size`
,如
`model = paddleclas.PaddleClas(model_name="person_exists", batch_size=2)`
。更换其他模型只需要替换
`model_name`
,
`model_name`
,可以参考
[
模型库
](
./PULC_model_list.md
)
。
<a
name=
"3"
></a>
## 3. 小结
通过本节内容,相信您已经熟练掌握 PaddleClas whl 包的 PULC 模型使用方法并获得了初步效果。
PULC 方法产出的系列模型在人、车、OCR等方向的多个场景中均验证有效,用超轻量模型就可实现与 SwinTransformer 模型接近的精度,预测速度提高 40+ 倍。并且打通数据、模型训练、压缩和推理部署全流程,您可以参考
[
文档教程
](
./PULC_train.md
)
,正式开启 PULC 的体验之旅。
docs/zh_CN/PULC/PULC_text_image_orientation.md
浏览文件 @
c43146f1
# PULC含文字图像方向分类模型
# PULC
含文字图像方向分类模型
## 目录
-
[
1.
模型和应用场景介绍
](
#1
)
-
[
2.
模型快速体验
](
#2
)
-
[
1. 模型和应用场景介绍
](
#1
)
-
[
2. 模型快速体验
](
#2
)
-
[
2.1 安装 paddleclas
](
#2.1
)
-
[
2.2 预测
](
#2.2
)
-
[
3. 模型训练、评估和预测
](
#3
)
-
[
3. 模型训练、评估和预测
](
#3
)
-
[
3.1 环境配置
](
#3.1
)
-
[
3.2 数据准备
](
#3.2
)
-
[
3.2.1 数据集来源
](
#3.2.1
)
...
...
docs/zh_CN/PULC/PULC_traffic_sign.md
浏览文件 @
c43146f1
...
...
@@ -78,13 +78,13 @@ pip3 install paddlepaddle paddleclas
*
使用命令行快速预测
```
bash
paddleclas
--model_name
traffic_sign
--infer_imgs
PaddleClas/
deploy/images/PULC/traffic_sign/100999_83928.jpg
paddleclas
--model_name
traffic_sign
--infer_imgs
deploy/images/PULC/traffic_sign/100999_83928.jpg
```
结果如下:
```
>>> result
class_ids: [182, 179, 162, 128, 24], scores: [0.98623, 0.01255, 0.00022, 0.00021, 0.00012], label_names: ['pl110', 'pl100', 'pl120', 'p26', 'pm10'], filename:
PaddleClas/
deploy/images/PULC/traffic_sign/100999_83928.jpg
class_ids: [182, 179, 162, 128, 24], scores: [0.98623, 0.01255, 0.00022, 0.00021, 0.00012], label_names: ['pl110', 'pl100', 'pl120', 'p26', 'pm10'], filename: deploy/images/PULC/traffic_sign/100999_83928.jpg
```
**备注**
: 更换其他预测的数据时,只需要改变
`--infer_imgs=xx`
中的字段即可,支持传入整个文件夹。
...
...
@@ -94,7 +94,7 @@ class_ids: [182, 179, 162, 128, 24], scores: [0.98623, 0.01255, 0.00022, 0.00021
```
python
import
paddleclas
model
=
paddleclas
.
PaddleClas
(
model_name
=
"traffic_sign"
)
result
=
model
.
predict
(
input_data
=
"
PaddleClas/
deploy/images/PULC/traffic_sign/100999_83928.jpg"
)
result
=
model
.
predict
(
input_data
=
"deploy/images/PULC/traffic_sign/100999_83928.jpg"
)
print
(
next
(
result
))
```
...
...
@@ -102,7 +102,7 @@ print(next(result))
```
result
[{'class_ids': [182, 179, 162, 128, 24], 'scores': [0.98623, 0.01255, 0.00022, 0.00021, 0.00012], 'label_names': ['pl110', 'pl100', 'pl120', 'p26', 'pm10'], 'filename': '
PaddleClas/
deploy/images/PULC/traffic_sign/100999_83928.jpg'}]
[{'class_ids': [182, 179, 162, 128, 24], 'scores': [0.98623, 0.01255, 0.00022, 0.00021, 0.00012], 'label_names': ['pl110', 'pl100', 'pl120', 'p26', 'pm10'], 'filename': 'deploy/images/PULC/traffic_sign/100999_83928.jpg'}]
```
<a
name=
"3"
></a>
...
...
docs/zh_CN/PULC/PULC_vehicle_attribute.md
浏览文件 @
c43146f1
...
...
@@ -47,9 +47,9 @@
| Res2Net200_vd_26w_4s | 91.36 | 79.46 | 293 | 使用ImageNet预训练模型 |
| ResNet50 | 89.98 | 12.83 | 92 | 使用ImageNet预训练模型 |
| MobileNetV3_small_x0_35 | 87.41 | 2.91 | 2.8 | 使用ImageNet预训练模型 |
| PPLCNet_x1_0 | 89.57 | 2.36 |
8
.2 | 使用ImageNet预训练模型 |
| PPLCNet_x1_0 | 90.07 | 2.36 |
8
.2 | 使用SSLD预训练模型 |
| PPLCNet_x1_0 | 90.59 | 2.36 |
8
.2 | 使用SSLD预训练模型+EDA策略|
| PPLCNet_x1_0 | 89.57 | 2.36 |
7
.2 | 使用ImageNet预训练模型 |
| PPLCNet_x1_0 | 90.07 | 2.36 |
7
.2 | 使用SSLD预训练模型 |
| PPLCNet_x1_0 | 90.59 | 2.36 |
7
.2 | 使用SSLD预训练模型+EDA策略|
|
<b>
PPLCNet_x1_0
<b>
|
<b>
90.81
<b>
|
<b>
2.36
<b>
|
<b>
8.2
<b>
| 使用SSLD预训练模型+EDA策略+SKL-UGI知识蒸馏策略|
从表中可以看出,backbone 为 Res2Net200_vd_26w_4s 时精度较高,但是推理速度较慢。将 backbone 替换为轻量级模型 MobileNetV3_small_x0_35 后,速度可以大幅提升,但是精度下降明显。将 backbone 替换为 PPLCNet_x1_0 时,精度提升 2.16%,同时速度也提升 23% 左右。在此基础上,使用 SSLD 预训练模型后,在不改变推理速度的前提下,精度可以提升约 0.5%,进一步地,当融合EDA策略后,精度可以再提升 0.52%,最后,在使用 SKL-UGI 知识蒸馏后,精度可以继续提升 0.23%。此时,PPLCNet_x1_0 的精度与 Res2Net200_vd_26w_4s 仅相差0.55%,但是速度快32倍。关于 PULC 的训练方法和推理部署方法将在下面详细介绍。
...
...
@@ -79,13 +79,13 @@ pip3 install paddlepaddle paddleclas
*
使用命令行快速预测
```
bash
paddleclas
--model_name
vehicle_attribute
--infer_imgs
PaddleClas/
deploy/images/PULC/vehicle_attribute/0002_c002_00030670_0.jpg
paddleclas
--model_name
vehicle_attribute
--infer_imgs
deploy/images/PULC/vehicle_attribute/0002_c002_00030670_0.jpg
```
结果如下:
```
>>> result
attributes: Color: (yellow, prob: 0.9893476963043213), Type: (hatchback, prob: 0.9734097719192505), output: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], filename:
PaddleClas/
deploy/images/PULC/vehicle_attribute/0002_c002_00030670_0.jpg
attributes: Color: (yellow, prob: 0.9893476963043213), Type: (hatchback, prob: 0.9734097719192505), output: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], filename: deploy/images/PULC/vehicle_attribute/0002_c002_00030670_0.jpg
ppcls INFO: Predict complete!
```
...
...
@@ -96,7 +96,7 @@ ppcls INFO: Predict complete!
```
python
import
paddleclas
model
=
paddleclas
.
PaddleClas
(
model_name
=
"vehicle_attribute"
)
result
=
model
.
predict
(
input_data
=
"
PaddleClas/
deploy/images/PULC/vehicle_attribute/0002_c002_00030670_0.jpg"
)
result
=
model
.
predict
(
input_data
=
"deploy/images/PULC/vehicle_attribute/0002_c002_00030670_0.jpg"
)
print
(
next
(
result
))
```
...
...
@@ -104,7 +104,7 @@ print(next(result))
```
result
[{'attributes': 'Color: (yellow, prob: 0.9893476963043213), Type: (hatchback, prob: 0.9734097719192505)', 'output': [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 'filename': '
PaddleClas/
deploy/images/PULC/vehicle_attribute/0002_c002_00030670_0.jpg'}]
[{'attributes': 'Color: (yellow, prob: 0.9893476963043213), Type: (hatchback, prob: 0.9734097719192505)', 'output': [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 'filename': 'deploy/images/PULC/vehicle_attribute/0002_c002_00030670_0.jpg'}]
```
<a
name=
"3"
></a>
...
...
paddleclas.py
浏览文件 @
c43146f1
...
...
@@ -178,7 +178,7 @@ IMN_MODEL_SERIES = {
PULC_MODEL_BASE_DOWNLOAD_URL
=
"https://paddleclas.bj.bcebos.com/models/PULC/{}_infer.tar"
PULC_MODELS
=
[
"person_exists"
,
"person_attribute"
,
"safety_helmet"
,
"traffic_sign"
,
"vehicle_exists"
,
"vehicle_attr"
,
"textline_orientation"
,
"vehicle_exists"
,
"vehicle_attr
ibute
"
,
"textline_orientation"
,
"text_image_orientation"
,
"language_classification"
]
...
...
@@ -247,8 +247,10 @@ def init_config(model_type, model_name, inference_model_dir, **kwargs):
cfg
.
PostProcess
.
Topk
.
class_id_map_file
=
kwargs
[
"class_id_map_file"
]
else
:
c
fg
.
PostProcess
.
Topk
.
class_id_map_file
=
os
.
path
.
relpath
(
c
lass_id_map_file_path
=
os
.
path
.
relpath
(
cfg
.
PostProcess
.
Topk
.
class_id_map_file
,
"../"
)
cfg
.
PostProcess
.
Topk
.
class_id_map_file
=
os
.
path
.
join
(
__dir__
,
class_id_map_file_path
)
if
"VehicleAttribute"
in
cfg
.
PostProcess
:
if
"color_threshold"
in
kwargs
and
kwargs
[
"color_threshold"
]:
cfg
.
PostProcess
.
VehicleAttribute
.
color_threshold
=
kwargs
[
...
...
ppcls/configs/PULC/language_classification/MobileNetV3_small_x0_35.yaml
浏览文件 @
c43146f1
...
...
@@ -121,7 +121,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/language_classification_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/language_classification_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/language_classification/PPLCNet_x1_0.yaml
浏览文件 @
c43146f1
...
...
@@ -132,7 +132,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/language_classification_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/language_classification_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/language_classification/PPLCNet_x1_0_distillation.yaml
浏览文件 @
c43146f1
...
...
@@ -152,7 +152,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/language_classification_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/language_classification_label_list.txt
Metric
:
Train
:
...
...
@@ -161,4 +161,4 @@ Metric:
topk
:
[
1
,
2
]
Eval
:
-
TopkAcc
:
topk
:
[
1
,
2
]
\ No newline at end of file
topk
:
[
1
,
2
]
ppcls/configs/PULC/language_classification/PPLCNet_x1_0_search.yaml
浏览文件 @
c43146f1
...
...
@@ -131,7 +131,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/language_classification_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/language_classification_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/language_classification/SwinTransformer_tiny_patch4_window7_224.yaml
浏览文件 @
c43146f1
...
...
@@ -152,7 +152,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/language_classification_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/language_classification_label_list.txt
Metric
:
Eval
:
...
...
ppcls/configs/PULC/text_image_orientation/MobileNetV3_small_x0_35.yaml
浏览文件 @
c43146f1
...
...
@@ -121,7 +121,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/text_image_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/text_image_orientation_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/text_image_orientation/PPLCNet_x1_0.yaml
浏览文件 @
c43146f1
...
...
@@ -132,7 +132,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/text_image_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/text_image_orientation_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/text_image_orientation/PPLCNet_x1_0_distillation.yaml
浏览文件 @
c43146f1
...
...
@@ -152,7 +152,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/text_image_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/text_image_orientation_label_list.txt
Metric
:
Train
:
...
...
@@ -161,4 +161,4 @@ Metric:
topk
:
[
1
,
2
]
Eval
:
-
TopkAcc
:
topk
:
[
1
,
2
]
\ No newline at end of file
topk
:
[
1
,
2
]
ppcls/configs/PULC/text_image_orientation/PPLCNet_x1_0_search.yaml
浏览文件 @
c43146f1
...
...
@@ -135,7 +135,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/text_image_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/text_image_orientation_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/text_image_orientation/SwinTransformer_tiny_patch4_window7_224.yaml
浏览文件 @
c43146f1
...
...
@@ -149,7 +149,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
2
class_id_map_file
:
ppcls/utils/PULC/text_image_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/text_image_orientation_label_list.txt
Metric
:
Eval
:
...
...
ppcls/configs/PULC/textline_orientation/MobileNetV3_small_x0_35.yaml
浏览文件 @
c43146f1
...
...
@@ -123,7 +123,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
1
class_id_map_file
:
ppcls/utils/PULC/textline_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/textline_orientation_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/textline_orientation/PPLCNet_x1_0.yaml
浏览文件 @
c43146f1
...
...
@@ -132,7 +132,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
1
class_id_map_file
:
ppcls/utils/PULC/textline_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/textline_orientation_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/textline_orientation/PPLCNet_x1_0_224x224.yaml
浏览文件 @
c43146f1
...
...
@@ -121,7 +121,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
1
class_id_map_file
:
ppcls/utils/PULC/textline_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/textline_orientation_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/textline_orientation/PPLCNet_x1_0_distillation.yaml
浏览文件 @
c43146f1
...
...
@@ -150,7 +150,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
1
class_id_map_file
:
ppcls/utils/PULC/textline_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/textline_orientation_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/textline_orientation/PPLCNet_x1_0_search.yaml
浏览文件 @
c43146f1
...
...
@@ -133,7 +133,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
1
class_id_map_file
:
ppcls/utils/PULC/textline_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/textline_orientation_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/textline_orientation/SwinTransformer_tiny_patch4_window7_224.yaml
浏览文件 @
c43146f1
...
...
@@ -153,7 +153,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
1
class_id_map_file
:
ppcls/utils/PULC/textline_orientation_label_list.txt
class_id_map_file
:
ppcls/utils/PULC
_label_list
/textline_orientation_label_list.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/traffic_sign/MobileNetV3_samll_x0_35.yaml
浏览文件 @
c43146f1
...
...
@@ -120,7 +120,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
5
class_id_map_file
:
dataset/traffic_sign/label_name_id
.txt
class_id_map_file
:
ppcls/utils/PULC_label_list/traffic_sign_label_list
.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/traffic_sign/PPLCNet_x1_0.yaml
浏览文件 @
c43146f1
...
...
@@ -137,7 +137,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
5
class_id_map_file
:
dataset/traffic_sign/label_name_id
.txt
class_id_map_file
:
ppcls/utils/PULC_label_list/traffic_sign_label_list
.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/traffic_sign/PPLCNet_x1_0_distillation.yaml
浏览文件 @
c43146f1
...
...
@@ -160,7 +160,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
5
class_id_map_file
:
dataset/traffic_sign/label_name_id
.txt
class_id_map_file
:
ppcls/utils/PULC_label_list/traffic_sign_label_list
.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/traffic_sign/PPLCNet_x1_0_search.yaml
浏览文件 @
c43146f1
...
...
@@ -138,7 +138,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
5
class_id_map_file
:
dataset/traffic_sign/label_name_id
.txt
class_id_map_file
:
ppcls/utils/PULC_label_list/traffic_sign_label_list
.txt
Metric
:
Train
:
...
...
ppcls/configs/PULC/traffic_sign/SwinTransformer_tiny_patch4_window7_224.yaml
浏览文件 @
c43146f1
...
...
@@ -157,7 +157,7 @@ Infer:
PostProcess
:
name
:
Topk
topk
:
5
class_id_map_file
:
dataset/traffic_sign/label_name_id
.txt
class_id_map_file
:
ppcls/utils/PULC_label_list/traffic_sign_label_list
.txt
Metric
:
Train
:
...
...
ppcls/utils/PULC/text_image_orientation_label_list.txt
已删除
100644 → 0
浏览文件 @
5b807c1b
0 0
1 90
2 180
3 270
ppcls/utils/PULC/language_classification_label_list.txt
→
ppcls/utils/PULC
_label_list
/language_classification_label_list.txt
浏览文件 @
c43146f1
文件已移动
ppcls/utils/PULC/textline_orientation_label_list.txt
→
ppcls/utils/PULC
_label_list
/textline_orientation_label_list.txt
浏览文件 @
c43146f1
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录