Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
48db9a8c
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看板
未验证
提交
48db9a8c
编写于
10月 18, 2021
作者:
S
shangliang Xu
提交者:
GitHub
10月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ce tests] add kl to ce (#4311)
上级
7d625608
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
65 addition
and
28 deletion
+65
-28
configs/slim/post_quant/ppyolo_r50vd_dcn_ptq.yml
configs/slim/post_quant/ppyolo_r50vd_dcn_ptq.yml
+10
-0
configs/slim/post_quant/yolov3_darknet53_ptq.yml
configs/slim/post_quant/yolov3_darknet53_ptq.yml
+10
-0
tests/ppdet_params/ppyolo_mbv3_large_coco_params.txt
tests/ppdet_params/ppyolo_mbv3_large_coco_params.txt
+2
-2
tests/ppdet_params/ppyolo_r50vd_dcn_1x_coco_params.txt
tests/ppdet_params/ppyolo_r50vd_dcn_1x_coco_params.txt
+2
-2
tests/ppdet_params/yolov3_darknet53_270e_coco_params.txt
tests/ppdet_params/yolov3_darknet53_270e_coco_params.txt
+2
-2
tests/prepare.sh
tests/prepare.sh
+1
-0
tests/test.sh
tests/test.sh
+38
-22
未找到文件。
configs/slim/post_quant/ppyolo_r50vd_dcn_ptq.yml
0 → 100644
浏览文件 @
48db9a8c
weights
:
https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams
slim
:
PTQ
PTQ
:
ptq_config
:
{
'
activation_quantizer'
:
'
HistQuantizer'
,
'
upsample_bins'
:
127
,
'
hist_percent'
:
0.999
}
quant_batch_num
:
10
fuse
:
True
configs/slim/post_quant/yolov3_darknet53_ptq.yml
0 → 100644
浏览文件 @
48db9a8c
weights
:
https://paddledet.bj.bcebos.com/models/yolov3_darknet53_270e_coco.pdparams
slim
:
PTQ
PTQ
:
ptq_config
:
{
'
activation_quantizer'
:
'
HistQuantizer'
,
'
upsample_bins'
:
127
,
'
hist_percent'
:
0.999
}
quant_batch_num
:
10
fuse
:
True
tests/ppdet_params/ppyolo_mbv3_large_coco_params.txt
浏览文件 @
48db9a8c
...
...
@@ -31,11 +31,11 @@ norm_export:tools/export_model.py -c configs/ppyolo/ppyolo_mbv3_large_coco.yml -
quant_export:tools/export_model.py -c configs/ppyolo/ppyolo_mbv3_large_coco.yml --slim_config configs/slim/quant/ppyolo_mbv3_large_qat.yml -o
fpgm_export:tools/export_model.py -c configs/ppyolo/ppyolo_mbv3_large_coco.yml --slim_config configs/slim/prune/ppyolo_mbv3_large_prune_fpgm.yml -o
distill_export:null
export1:null
kl_quant:tools/post_quant.py -c configs/ppyolo/ppyolo_mbv3_large_coco.yml --slim_config configs/slim/post_quant/ppyolo_mbv3_large_ptq.yml -o
export2:null
##
infer_model:ppyolo_mbv3_large_coco.pdparams|ppyolo_mbv3_large_qat.pdparams|ppyolo_mbv3_large_prune_fpgm.pdparams
infer_
export:./tests/weights|./tests/weights|
./tests/weights
infer_
model_dir:
./tests/weights
infer_quant:False|True|False
inference:deploy/python/infer.py
--device:gpu|cpu
...
...
tests/ppdet_params/ppyolo_r50vd_dcn_1x_coco_params.txt
浏览文件 @
48db9a8c
...
...
@@ -31,11 +31,11 @@ norm_export:tools/export_model.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml
quant_export:tools/export_model.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml --slim_config configs/slim/quant/ppyolo_r50vd_qat_pact.yml -o
fpgm_export:tools/export_model.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml --slim_config configs/slim/prune/ppyolo_r50vd_prune_fpgm.yml -o
distill_export:null
export1:null
kl_quant:tools/post_quant.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml --slim_config configs/slim/post_quant/ppyolo_r50vd_dcn_ptq.yml -o
export2:null
##
infer_model:ppyolo_r50vd_dcn_1x_coco.pdparams|ppyolo_r50vd_qat_pact.pdparams|ppyolo_r50vd_prune_fpgm.pdparams
infer_
export:./tests/weights|./tests/weights|
./tests/weights
infer_
model_dir:
./tests/weights
infer_quant:False|True|False
inference:deploy/python/infer.py
--device:gpu|cpu
...
...
tests/ppdet_params/yolov3_darknet53_270e_coco_params.txt
浏览文件 @
48db9a8c
...
...
@@ -31,11 +31,11 @@ norm_export:tools/export_model.py -c configs/yolov3/yolov3_darknet53_270e_coco.y
quant_export:tools/export_model.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --slim_config configs/slim/quant/yolov3_darknet_qat.yml -o
fpgm_export:tools/export_model.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --slim_config configs/slim/prune/yolov3_darknet_prune_fpgm.yml -o
distill_export:null
export1:null
kl_quant:tools/post_quant.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o
export2:null
##
infer_model:yolov3_darknet53_270e_coco.pdparams|yolov3_darknet_coco_qat.pdparams|yolov3_darknet_prune_fpgm.pdparams
infer_
export:./tests/weights|./tests/weights|
./tests/weights
infer_
model_dir:
./tests/weights
infer_quant:False|True|False
inference:deploy/python/infer.py
--device:gpu|cpu
...
...
tests/prepare.sh
浏览文件 @
48db9a8c
...
...
@@ -60,6 +60,7 @@ elif [ ${MODE} = "whole_infer" ];then
cd
../../
&&
mkdir
-p
./tests/demo/
cp
-u
dataset/coco/val2017/
*
./tests/demo/
else
mv
./dataset/coco/download_coco.py
.
&&
rm
-rf
./dataset/coco/
*
&&
mv
./download_coco.py ./dataset/coco/
# prepare infer data
wget
-nc
-P
./dataset/coco/ https://paddledet.bj.bcebos.com/data/coco_ce.tar
cd
./dataset/coco/
&&
tar
-xvf
coco_ce.tar
&&
mv
-u
coco_ce/
*
.
...
...
tests/test.sh
浏览文件 @
48db9a8c
...
...
@@ -119,8 +119,8 @@ export_key2=$(func_parser_key "${lines[34]}")
export_value2
=
$(
func_parser_value
"
${
lines
[34]
}
"
)
# parser inference model
infer_model_
dir
_list
=
$(
func_parser_value
"
${
lines
[36]
}
"
)
infer_
export_list
=
$(
func_parser_value
"
${
lines
[37]
}
"
)
infer_model_
name
_list
=
$(
func_parser_value
"
${
lines
[36]
}
"
)
infer_
model_dir
=
$(
func_parser_value
"
${
lines
[37]
}
"
)
infer_is_quant
=
$(
func_parser_value
"
${
lines
[38]
}
"
)
# parser inference
inference_py
=
$(
func_parser_value
"
${
lines
[39]
}
"
)
...
...
@@ -185,14 +185,13 @@ function func_inference(){
elif
[
${
device
}
=
"True"
]
||
[
${
device
}
=
"gpu"
]
;
then
for
use_trt
in
${
use_trt_list
[*]
}
;
do
for
precision
in
${
precision_list
[*]
}
;
do
if
[[
${
_flag_quant
}
=
"False"
]]
&&
[[
${
precision
}
=
~
"int8"
]]
;
then
continue
fi
if
[[
${
precision
}
=
~
"fp16"
||
${
precision
}
=
~
"int8"
]]
&&
[
${
use_trt
}
=
"False"
]
;
then
continue
fi
if
[[
${
use_trt
}
=
"False"
||
${
precision
}
=
~
"int8"
]]
&&
[
${
_flag_quant
}
=
"True"
]
;
then
continue
if
[[
${
precision
}
!=
"fluid"
]]
;
then
if
[[
${
_flag_quant
}
=
"False"
]]
&&
[[
${
precision
}
=
"trt_int8"
]]
;
then
continue
fi
if
[[
${
_flag_quant
}
=
"True"
]]
&&
[[
${
precision
}
!=
"trt_int8"
]]
;
then
continue
fi
fi
for
batch_size
in
${
batch_size_list
[*]
}
;
do
_save_log_path
=
"
${
_log_path
}
/infer_gpu_usetrt_
${
use_trt
}
_precision_
${
precision
}
_batchsize_
${
batch_size
}
.log"
...
...
@@ -229,28 +228,45 @@ if [ ${MODE} = "infer" ]; then
eval
$env
export
Count
=
0
IFS
=
"|"
infer_run_exports
=(
${
infer_export_list
}
)
infer_quant_flag
=(
${
infer_is_quant
}
)
set_train_params1
=
$(
func_set_params
"
${
train_param_key1
}
"
"
${
train_param_value1
}
"
)
for
infer_model
in
${
infer_model_dir_list
[*]
}
;
do
set_save_infer_key
=
$(
func_set_params
"
${
save_infer_key
}
"
"
${
infer_model_dir
}
"
)
infer_model
=
"
${
infer_model_dir
}
/
${
train_param_value1
}
"
for
infer_model_name
in
${
infer_model_name_list
[*]
}
;
do
# run export
if
[
${
infer_run_exports
[Count]
}
!=
"null"
]
;
then
set_export_weight
=
$(
func_set_params
"
${
export_weight
}
"
"
${
infer_run_exports
[Count]
}
/
${
infer_model
}
"
)
set_save_infer_key
=
$(
func_set_params
"
${
save_infer_key
}
"
"
${
infer_run_exports
[Count]
}
"
)
export_cmd
=
"
${
python
}
${
norm_export
}
${
set_export_weight
}
${
set_train_params1
}
${
set_save_infer_key
}
"
eval
$export_cmd
status_export
=
$?
if
[
${
status_export
}
=
0
]
;
then
status_check
$status_export
"
${
export_cmd
}
"
"
${
status_log
}
"
fi
case
${
Count
}
in
0
)
run_export
=
${
norm_export
}
;;
1
)
run_export
=
${
pact_export
}
;;
2
)
run_export
=
${
fpgm_export
}
;;
*
)
echo
"Undefined run_export"
;
exit
1
;
esac
set_export_weight
=
$(
func_set_params
"
${
export_weight
}
"
"
${
infer_model_dir
}
/
${
infer_model_name
}
"
)
export_cmd
=
"
${
python
}
${
run_export
}
${
set_export_weight
}
${
set_train_params1
}
${
set_save_infer_key
}
"
eval
$export_cmd
status_export
=
$?
if
[
${
status_export
}
=
0
]
;
then
status_check
$status_export
"
${
export_cmd
}
"
"
${
status_log
}
"
fi
#run inference
is_quant
=
${
infer_quant_flag
[Count]
}
infer_model
=
"
${
infer_run_exports
[Count]
}
/
${
train_param_value1
}
"
func_inference
"
${
python
}
"
"
${
inference_py
}
"
"
${
infer_model
}
"
"
${
LOG_PATH
}
"
"
${
infer_img_dir
}
"
${
is_quant
}
Count
=
$((
$Count
+
1
))
done
# kl quant
if
[
${
export_key1
}
=
"kl_quant"
]
;
then
# run kl quant
kl_cmd
=
"
${
python
}
${
export_value1
}
${
set_train_params1
}
${
set_save_infer_key
}
"
eval
$kl_cmd
status_export
=
$?
if
[
${
status_export
}
=
0
]
;
then
status_check
$status_export
"
${
kl_cmd
}
"
"
${
status_log
}
"
fi
# run inference
is_quant
=
True
func_inference
"
${
python
}
"
"
${
inference_py
}
"
"
${
infer_model
}
"
"
${
LOG_PATH
}
"
"
${
infer_img_dir
}
"
${
is_quant
}
fi
else
IFS
=
"|"
export
Count
=
0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录