Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
7dcc3890
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7dcc3890
编写于
10月 11, 2019
作者:
L
Liufang Sang
提交者:
whs
10月 11, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix params filename, pretrain model path (#3513)
上级
7b612768
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
10 deletion
+10
-10
PaddleCV/PaddleDetection/slim/quantization/README.md
PaddleCV/PaddleDetection/slim/quantization/README.md
+3
-3
PaddleCV/PaddleDetection/slim/quantization/freeze.py
PaddleCV/PaddleDetection/slim/quantization/freeze.py
+3
-3
PaddleCV/PaddleDetection/slim/quantization/yolov3_mobilenet_v1_voc.yml
...leDetection/slim/quantization/yolov3_mobilenet_v1_voc.yml
+1
-1
PaddleSlim/classification/quantization/freeze.py
PaddleSlim/classification/quantization/freeze.py
+3
-3
未找到文件。
PaddleCV/PaddleDetection/slim/quantization/README.md
浏览文件 @
7dcc3890
...
@@ -121,17 +121,17 @@ QuantizationFreezePass主要用于改变IrGraph中量化op和反量化op的顺
...
@@ -121,17 +121,17 @@ QuantizationFreezePass主要用于改变IrGraph中量化op和反量化op的顺
python eval.py --model_path ${checkpoint_path}/${epoch_id}/eval_model/ --model_name __model__ --params_name __params__ -c yolov3_mobilenet_v1_voc.yml
python eval.py --model_path ${checkpoint_path}/${epoch_id}/eval_model/ --model_name __model__ --params_name __params__ -c yolov3_mobilenet_v1_voc.yml
```
```
在评估之后,选取效果最好的epoch的模型,可使用脚本
<a
href=
'./freeze.py'
>
slim/quantization/freeze.py
</a>
将该模型转化为以上介绍的三种模型:
float
模型,int8模型,mobile模型,需要配置的参数为:
在评估之后,选取效果最好的epoch的模型,可使用脚本
<a
href=
'./freeze.py'
>
slim/quantization/freeze.py
</a>
将该模型转化为以上介绍的三种模型:
FP32
模型,int8模型,mobile模型,需要配置的参数为:
-
model_path, 加载的模型路径,
`为${checkpoint_path}/${epoch_id}/eval_model/`
-
model_path, 加载的模型路径,
`为${checkpoint_path}/${epoch_id}/eval_model/`
-
weight_quant_type 模型参数的量化方式,和配置文件中的类型保持一致
-
weight_quant_type 模型参数的量化方式,和配置文件中的类型保持一致
-
save_path
`FP32`
,
`8-bit`
,
`mobile`
模型的保存路径,分别为
`${save_path}/float/`
,
`${save_path}/int8/`
,
`${save_path}/mobile/`
-
save_path
`FP32`
,
`8-bit`
,
`mobile`
模型的保存路径,分别为
`${save_path}/float/`
,
`${save_path}/int8/`
,
`${save_path}/mobile/`
### 最终评估模型
### 最终评估模型
最终使用的评估模型是
float
模型,使用脚本
<a
href=
"./eval.py"
>
slim/quantization/eval.py
</a>
中为使用该模型在评估数据集上做评估的示例。
最终使用的评估模型是
FP32
模型,使用脚本
<a
href=
"./eval.py"
>
slim/quantization/eval.py
</a>
中为使用该模型在评估数据集上做评估的示例。
运行命令为:
运行命令为:
```
```
python eval.py --model_path ${float_model_path} --model_name model --params_name
param
s -c yolov3_mobilenet_v1_voc.yml
python eval.py --model_path ${float_model_path} --model_name model --params_name
weight
s -c yolov3_mobilenet_v1_voc.yml
```
```
## 预测
## 预测
...
...
PaddleCV/PaddleDetection/slim/quantization/freeze.py
浏览文件 @
7dcc3890
...
@@ -175,7 +175,7 @@ def main():
...
@@ -175,7 +175,7 @@ def main():
executor
=
exe
,
executor
=
exe
,
main_program
=
server_program
,
main_program
=
server_program
,
model_filename
=
'model'
,
model_filename
=
'model'
,
params_filename
=
'
param
s'
)
params_filename
=
'
weight
s'
)
logger
.
info
(
"convert the weights into int8 type"
)
logger
.
info
(
"convert the weights into int8 type"
)
convert_int8_pass
=
ConvertToInt8Pass
(
convert_int8_pass
=
ConvertToInt8Pass
(
...
@@ -190,7 +190,7 @@ def main():
...
@@ -190,7 +190,7 @@ def main():
executor
=
exe
,
executor
=
exe
,
main_program
=
server_int8_program
,
main_program
=
server_int8_program
,
model_filename
=
'model'
,
model_filename
=
'model'
,
params_filename
=
'
param
s'
)
params_filename
=
'
weight
s'
)
logger
.
info
(
"convert the freezed pass to paddle-lite execution"
)
logger
.
info
(
"convert the freezed pass to paddle-lite execution"
)
mobile_pass
=
TransformForMobilePass
()
mobile_pass
=
TransformForMobilePass
()
...
@@ -203,7 +203,7 @@ def main():
...
@@ -203,7 +203,7 @@ def main():
executor
=
exe
,
executor
=
exe
,
main_program
=
mobile_program
,
main_program
=
mobile_program
,
model_filename
=
'model'
,
model_filename
=
'model'
,
params_filename
=
'
param
s'
)
params_filename
=
'
weight
s'
)
...
...
PaddleCV/PaddleDetection/slim/quantization/yolov3_mobilenet_v1_voc.yml
浏览文件 @
7dcc3890
...
@@ -9,7 +9,7 @@ save_dir: output
...
@@ -9,7 +9,7 @@ save_dir: output
snapshot_iter
:
2000
snapshot_iter
:
2000
metric
:
VOC
metric
:
VOC
map_type
:
11point
map_type
:
11point
pretrain_weights
:
http
://paddle-imagenet-models-name.bj.bcebos.com/MobileNetV1_pretrained
.tar
pretrain_weights
:
http
s://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v1_voc
.tar
weights
:
output/yolov3_mobilenet_v1_voc/model_final
weights
:
output/yolov3_mobilenet_v1_voc/model_final
num_classes
:
20
num_classes
:
20
...
...
PaddleSlim/classification/quantization/freeze.py
浏览文件 @
7dcc3890
...
@@ -86,7 +86,7 @@ def eval(args):
...
@@ -86,7 +86,7 @@ def eval(args):
executor
=
exe
,
executor
=
exe
,
main_program
=
server_program
,
main_program
=
server_program
,
model_filename
=
'model'
,
model_filename
=
'model'
,
params_filename
=
'
param
s'
)
params_filename
=
'
weight
s'
)
_logger
.
info
(
"convert the weights into int8 type"
)
_logger
.
info
(
"convert the weights into int8 type"
)
convert_int8_pass
=
ConvertToInt8Pass
(
convert_int8_pass
=
ConvertToInt8Pass
(
...
@@ -101,7 +101,7 @@ def eval(args):
...
@@ -101,7 +101,7 @@ def eval(args):
executor
=
exe
,
executor
=
exe
,
main_program
=
server_int8_program
,
main_program
=
server_int8_program
,
model_filename
=
'model'
,
model_filename
=
'model'
,
params_filename
=
'
param
s'
)
params_filename
=
'
weight
s'
)
_logger
.
info
(
"convert the freezed pass to paddle-lite execution"
)
_logger
.
info
(
"convert the freezed pass to paddle-lite execution"
)
mobile_pass
=
TransformForMobilePass
()
mobile_pass
=
TransformForMobilePass
()
...
@@ -114,7 +114,7 @@ def eval(args):
...
@@ -114,7 +114,7 @@ def eval(args):
executor
=
exe
,
executor
=
exe
,
main_program
=
mobile_program
,
main_program
=
mobile_program
,
model_filename
=
'model'
,
model_filename
=
'model'
,
params_filename
=
'
param
s'
)
params_filename
=
'
weight
s'
)
def
main
():
def
main
():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录