未验证 提交 80f1f748 编写于 作者: G Guanghua Yu 提交者: GitHub

update slim models and benchmark (#3077)

* update slim models and benchmark
上级 571dcb34
此差异已折叠。
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyolo_mbv3_large_coco.pdparams
slim: Pruner
Pruner:
criterion: fpgm
pruned_params: ['conv2d_62.w_0', 'conv2d_63.w_0', 'conv2d_64.w_0',
'conv2d_65.w_0', 'conv2d_66.w_0', 'conv2d_67.w_0']
pruned_ratios: [0.75, 0.75, 0.75, 0.75, 0.75, 0.75]
print_params: True
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams
slim: Pruner
Pruner:
criterion: fpgm
pruned_params: ['conv2d_56.w_0', 'conv2d_57.w_0', 'conv2d_58.w_0',
'conv2d_59.w_0', 'conv2d_60.w_0', 'conv2d_61.w_0',
'conv2d_63.w_0', 'conv2d_64.w_0', 'conv2d_65.w_0',
'conv2d_66.w_0', 'conv2d_67.w_0', 'conv2d_68.w_0',
'conv2d_70.w_0', 'conv2d_71.w_0', 'conv2d_72.w_0',
'conv2d_73.w_0', 'conv2d_74.w_0', 'conv2d_75.w_0']
pruned_ratios: [0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.875,0.875,0.875,0.875,0.875,0.875]
print_params: False
pretrain_weights: https://paddledet.bj.bcebos.com/models/yolov3_darknet53_270e_coco.pdparams
slim: Pruner
Pruner:
criterion: fpgm
pruned_params: ['conv2d_52.w_0', 'conv2d_53.w_0', 'conv2d_54.w_0',
'conv2d_55.w_0', 'conv2d_56.w_0', 'conv2d_57.w_0',
'conv2d_59.w_0', 'conv2d_60.w_0', 'conv2d_61.w_0',
'conv2d_62.w_0', 'conv2d_63.w_0', 'conv2d_64.w_0',
'conv2d_66.w_0', 'conv2d_67.w_0', 'conv2d_68.w_0',
'conv2d_69.w_0', 'conv2d_70.w_0', 'conv2d_71.w_0']
pruned_ratios: [0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.875,0.875,0.875,0.875,0.875,0.875]
print_params: True
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyolo_mbv3_large_coco.pdparams
slim: QAT
QAT:
quant_config: {
'weight_quantize_type': 'channel_wise_abs_max', 'activation_quantize_type': 'moving_average_abs_max',
'weight_bits': 8, 'activation_bits': 8, 'dtype': 'int8', 'window_size': 10000, 'moving_rate': 0.99,
'quantizable_layer_type': ['Conv2D', 'Linear']}
print_model: True
PPYOLOFPN:
in_channels: [160, 368]
coord_conv: true
conv_block_num: 0
spp: true
drop_block: false
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams
slim: QAT
QAT:
quant_config: {
'activation_preprocess_type': 'PACT',
'weight_quantize_type': 'channel_wise_abs_max', 'activation_quantize_type': 'moving_average_abs_max',
'weight_bits': 8, 'activation_bits': 8, 'dtype': 'int8', 'window_size': 10000, 'moving_rate': 0.9,
'quantizable_layer_type': ['Conv2D', 'Linear']}
print_model: True
epoch: 50
LearningRate:
base_lr: 0.0005
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones:
- 30
- 45
- !LinearWarmup
start_factor: 0.
steps: 1000
OptimizerBuilder:
optimizer:
momentum: 0.9
type: Momentum
regularizer:
factor: 0.0005
type: L2
PPYOLOFPN:
coord_conv: true
block_size: 3
keep_prob: 0.9
spp: true
drop_block: false
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyolov2_r50vd_dcn_365e_coco.pdparams
slim: QAT
QAT:
quant_config: {
'activation_preprocess_type': 'PACT',
'weight_quantize_type': 'channel_wise_abs_max', 'activation_quantize_type': 'moving_average_abs_max',
'weight_bits': 8, 'activation_bits': 8, 'dtype': 'int8', 'window_size': 10000, 'moving_rate': 0.9,
'quantizable_layer_type': ['Conv2D', 'Linear']}
print_model: True
epoch: 50
snapshot_epoch: 8
LearningRate:
base_lr: 0.0005
schedulers:
- !PiecewiseDecay
gamma: 0.1
milestones:
- 30
- 45
- !LinearWarmup
start_factor: 0.
steps: 2000
TrainReader:
batch_size: 8
PPYOLOPAN:
drop_block: false
block_size: 3
keep_prob: 0.9
spp: true
...@@ -4,21 +4,21 @@ slim: QAT ...@@ -4,21 +4,21 @@ slim: QAT
QAT: QAT:
quant_config: { quant_config: {
'weight_preprocess_type': 'PACT', 'activation_preprocess_type': 'PACT',
'weight_quantize_type': 'channel_wise_abs_max', 'activation_quantize_type': 'moving_average_abs_max', 'weight_quantize_type': 'channel_wise_abs_max', 'activation_quantize_type': 'moving_average_abs_max',
'weight_bits': 8, 'activation_bits': 8, 'dtype': 'int8', 'window_size': 10000, 'moving_rate': 0.9, 'weight_bits': 8, 'activation_bits': 8, 'dtype': 'int8', 'window_size': 10000, 'moving_rate': 0.9,
'quantizable_layer_type': ['Conv2D', 'Linear']} 'quantizable_layer_type': ['Conv2D', 'Linear']}
print_model: True print_model: True
epoch: 30 epoch: 50
LearningRate: LearningRate:
base_lr: 0.0001 base_lr: 0.0001
schedulers: schedulers:
- !PiecewiseDecay - !PiecewiseDecay
gamma: 0.1 gamma: 0.1
milestones: milestones:
- 25 - 35
- 28 - 45
- !LinearWarmup - !LinearWarmup
start_factor: 0. start_factor: 0.
steps: 2000 steps: 1000
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- `C++`语言部署 ,支持`CPU``GPU``XPU`环境,支持在`Linux``Windows`系统下部署,支持`NV Jetson`嵌入式设备上部署。请参考文档[C++部署](cpp/README.md) - `C++`语言部署 ,支持`CPU``GPU``XPU`环境,支持在`Linux``Windows`系统下部署,支持`NV Jetson`嵌入式设备上部署。请参考文档[C++部署](cpp/README.md)
- `TensorRT`加速:请参考文档[TensorRT预测部署教程](TENSOR_RT.md) - `TensorRT`加速:请参考文档[TensorRT预测部署教程](TENSOR_RT.md)
- 服务器端部署:使用[PaddleServing](./serving/README.md)部署。 - 服务器端部署:使用[PaddleServing](./serving/README.md)部署。
- 手机移动端部署:使用[Paddle-Lite](https://github.com/PaddlePaddle/Paddle-Lite) 在手机移动端部署。 - 手机移动端部署:使用[Paddle-Lite](./lite/README.md) 在手机移动端部署。
## 1.模型导出 ## 1.模型导出
......
...@@ -498,7 +498,7 @@ class Trainer(object): ...@@ -498,7 +498,7 @@ class Trainer(object):
}] }]
# dy2st and save model # dy2st and save model
if 'slim' not in self.cfg or self.cfg['slim'] != 'QAT': if 'slim' not in self.cfg or self.cfg['slim_type'] != 'QAT':
static_model = paddle.jit.to_static( static_model = paddle.jit.to_static(
self.model, input_spec=input_spec) self.model, input_spec=input_spec)
# NOTE: dy2st do not pruned program, but jit.save will prune program # NOTE: dy2st do not pruned program, but jit.save will prune program
......
...@@ -53,6 +53,7 @@ def build_slim_model(cfg, slim_cfg, mode='train'): ...@@ -53,6 +53,7 @@ def build_slim_model(cfg, slim_cfg, mode='train'):
if mode == 'train': if mode == 'train':
load_pretrain_weight(model, cfg.pretrain_weights) load_pretrain_weight(model, cfg.pretrain_weights)
slim = create(cfg.slim) slim = create(cfg.slim)
cfg['slim_type'] = cfg.slim
cfg['model'] = slim(model) cfg['model'] = slim(model)
cfg['slim'] = slim cfg['slim'] = slim
if mode != 'train': if mode != 'train':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册