Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
09e7665d
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
09e7665d
编写于
8月 08, 2022
作者:
J
JYChen
提交者:
GitHub
8月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add attr doc for ppvehicle (#6593)
上级
1995617c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
106 addition
and
10 deletion
+106
-10
deploy/pipeline/docs/images/vehicle_attribute.gif
deploy/pipeline/docs/images/vehicle_attribute.gif
+0
-0
deploy/pipeline/docs/tutorials/PPVehicle_QUICK_STARTED.md
deploy/pipeline/docs/tutorials/PPVehicle_QUICK_STARTED.md
+1
-1
deploy/pipeline/docs/tutorials/ppvehicle_attribute.md
deploy/pipeline/docs/tutorials/ppvehicle_attribute.md
+103
-7
deploy/python/infer.py
deploy/python/infer.py
+2
-2
未找到文件。
deploy/pipeline/docs/images/vehicle_attribute.gif
0 → 100644
浏览文件 @
09e7665d
3.9 MB
deploy/pipeline/docs/tutorials/PPVehicle_QUICK_STARTED.md
浏览文件 @
09e7665d
...
@@ -123,7 +123,7 @@ PP-Vehicle v2整体方案如下图所示:
...
@@ -123,7 +123,7 @@ PP-Vehicle v2整体方案如下图所示:
-
详细文档参考
[
OC-SORT
](
../../../../configs/mot/ocsort
)
和
[
检测跟踪文档
](
ppvehicle_mot.md
)
-
详细文档参考
[
OC-SORT
](
../../../../configs/mot/ocsort
)
和
[
检测跟踪文档
](
ppvehicle_mot.md
)
### 属性识别
### 属性识别
-
使用P
P-YOLOE + OC-SORT跟踪车辆
-
使用P
addleClas提供的特色模型PP-LCNet,实现对车辆颜色及车型属性的识别。
-
详细文档参考
[
属性识别
](
ppvehicle_attribute.md
)
-
详细文档参考
[
属性识别
](
ppvehicle_attribute.md
)
### 车牌识别
### 车牌识别
...
...
deploy/pipeline/docs/tutorials/ppvehicle_attribute.md
浏览文件 @
09e7665d
# PP-Vehicle属性识别模块
# PP-Vehicle属性识别模块
【应用介绍】
车辆属性识别在智慧城市,智慧交通等方向具有广泛应用。在PP-Vehicle中,集成了车辆属性识别模块,可识别车辆颜色及车型属性的识别。
【模型下载】
| 任务 | 算法 | 精度 | 预测速度 | 下载链接|
|-----------|------|-----------|----------|---------------|
| 车辆检测/跟踪 | PP-YOLOE | - | - |
[
预测部署模型
](
https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip
)
|
| 车辆属性识别 | PPLCNet | 90.81 | 2.36 ms |
[
预测部署模型
](
https://bj.bcebos.com/v1/paddledet/models/pipeline/vehicle_attribute_model.zip
)
|
注意:
1.
属性模型预测速度是基于Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz 测试得到,开启 MKLDNN 加速策略,线程数为10。
2.
关于PP-LCNet的介绍可以参考
[
PP-LCNet
](
https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/docs/zh_CN/models/PP-LCNet.md
)
介绍,相关论文可以查阅
[
PP-LCNet paper
](
https://arxiv.org/abs/2109.15099
)
。
3.
属性模型的训练和精度测试均基于
[
VeRi数据集
](
https://www.v7labs.com/open-datasets/veri-dataset
)
。
-
当前提供的预训练模型支持识别10种车辆颜色及9种车型,同VeRi数据集,具体如下:
```
yaml
# 车辆颜色
-
"
yellow"
-
"
orange"
-
"
green"
-
"
gray"
-
"
red"
-
"
blue"
-
"
white"
-
"
golden"
-
"
brown"
-
"
black"
# 车型
-
"
sedan"
-
"
suv"
-
"
van"
-
"
hatchback"
-
"
mpv"
-
"
pickup"
-
"
bus"
-
"
truck"
-
"
estate"
```
## 使用方法
## 使用方法
【配置项说明】
### 配置项说明
配置文件中与属性相关的参数如下:
```
VEHICLE_ATTR:
model_dir: output_inference/vehicle_attribute_infer/ # 车辆属性模型调用路径
batch_size: 8 # 模型预测时的batch_size大小
color_threshold: 0.5 # 颜色属性阈值,需要置信度达到此阈值才会确定具体颜色,否则为'Unknown‘
type_threshold: 0.5 # 车型属性阈值,需要置信度达到此阈值才会确定具体属性,否则为'Unknown‘
enable: False # 是否开启该功能
```
### 使用命令
1.
从模型库下载
`车辆检测/跟踪`
,
`车辆属性识别`
两个预测部署模型并解压到
`./output_inference`
路径下;默认会自动下载模型,如果手动下载,需要修改模型文件夹为模型存放路径。
2.
修改配置文件中
`VEHICLE_ATTR`
项的
`enable: True`
,以启用该功能。
3.
图片输入时,启动命令如下(更多命令参数说明,请参考
[
快速开始-参数说明
](
./PPVehicle_QUICK_STARTED.md
)
):
```
bash
# 预测单张图片文件
python deploy/pipeline/pipeline.py
--config
deploy/pipeline/config/infer_cfg_ppvehicle.yml
\
--image_file
=
test_image.jpg
\
--device
=
gpu
# 预测包含一张或多张图片的文件夹
python deploy/pipeline/pipeline.py
--config
deploy/pipeline/config/infer_cfg_ppvehicle.yml
\
--image_dir
=
images/
\
--device
=
gpu
```
4.
视频输入时,启动命令如下:
```
bash
#预测单个视频文件
python deploy/pipeline/pipeline.py
--config
deploy/pipeline/config/infer_cfg_ppvehicle.yml
\
--video_file
=
test_video.mp4
\
--device
=
gpu
#预测包含一个或多个视频的文件夹
python deploy/pipeline/pipeline.py
--config
deploy/pipeline/config/infer_cfg_ppvehicle.yml
\
--video_dir
=
test_videos/
\
--device
=
gpu
```
5.
若修改模型路径,有以下两种方式:
- 方法一:`./deploy/pipeline/config/infer_cfg_ppvehicle.yml`下可以配置不同模型路径,属性识别模型修改`VEHICLE_ATTR`字段下配置
- 方法二:命令行中增加--model_dir修改模型路径:
```
bash
python deploy/pipeline/pipeline.py
--config
deploy/pipeline/config/infer_cfg_ppvehicle.yml
\
--video_file
=
test_video.mp4
\
--device
=
gpu
\
--model_dir
vehicle_attr
=
output_inference/vehicle_attribute_infer
```
【使用命令】
测试效果如下:
【效果展示】
<div
width=
"1000"
align=
"center"
>
<img
src=
"../images/vehicle_attribute.gif"
/>
</div>
## 方案说明
## 方案说明
车辆属性模型使用了
[
PaddleClas
](
https://github.com/PaddlePaddle/PaddleClas
)
的超轻量图像分类方案(PULC,Practical Ultra Lightweight image Classification)。关于该模型的数据准备、训练、测试等详细内容,请见
[
PULC 车辆属性识别模型
](
https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/docs/zh_CN/PULC/PULC_vehicle_attribute.md
)
.
【实现方案及特色】
车辆属性识别模型选用了轻量级、高精度的PPLCNet。并在该模型的基础上,进一步使用了以下优化方案:
## 参考文献
-
使用SSLD预训练模型,在不改变推理速度的前提下,精度可以提升约0.5个百分点
-
融合EDA数据增强策略,精度可以再提升0.52个百分点
-
使用SKL-UGI知识蒸馏, 精度可以继续提升0.23个百分点
deploy/python/infer.py
浏览文件 @
09e7665d
...
@@ -42,7 +42,7 @@ from utils import argsparser, Timer, get_current_memory_mb
...
@@ -42,7 +42,7 @@ from utils import argsparser, Timer, get_current_memory_mb
SUPPORT_MODELS
=
{
SUPPORT_MODELS
=
{
'YOLO'
,
'RCNN'
,
'SSD'
,
'Face'
,
'FCOS'
,
'SOLOv2'
,
'TTFNet'
,
'S2ANet'
,
'JDE'
,
'YOLO'
,
'RCNN'
,
'SSD'
,
'Face'
,
'FCOS'
,
'SOLOv2'
,
'TTFNet'
,
'S2ANet'
,
'JDE'
,
'FairMOT'
,
'DeepSORT'
,
'GFL'
,
'PicoDet'
,
'CenterNet'
,
'TOOD'
,
'RetinaNet'
,
'FairMOT'
,
'DeepSORT'
,
'GFL'
,
'PicoDet'
,
'CenterNet'
,
'TOOD'
,
'RetinaNet'
,
'StrongBaseline'
,
'STGCN'
,
'YOLOX'
,
'PPHGNet'
'StrongBaseline'
,
'STGCN'
,
'YOLOX'
,
'PPHGNet'
,
'PPLCNet'
}
}
...
@@ -307,7 +307,7 @@ class Detector(object):
...
@@ -307,7 +307,7 @@ class Detector(object):
if
not
os
.
path
.
exists
(
self
.
output_dir
):
if
not
os
.
path
.
exists
(
self
.
output_dir
):
os
.
makedirs
(
self
.
output_dir
)
os
.
makedirs
(
self
.
output_dir
)
out_path
=
os
.
path
.
join
(
self
.
output_dir
,
video_out_name
)
out_path
=
os
.
path
.
join
(
self
.
output_dir
,
video_out_name
)
fourcc
=
cv2
.
VideoWriter_fourcc
(
*
'mp4v'
)
fourcc
=
cv2
.
VideoWriter_fourcc
(
*
'mp4v'
)
writer
=
cv2
.
VideoWriter
(
out_path
,
fourcc
,
fps
,
(
width
,
height
))
writer
=
cv2
.
VideoWriter
(
out_path
,
fourcc
,
fps
,
(
width
,
height
))
index
=
1
index
=
1
while
(
1
):
while
(
1
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录