PaddleSlim
PaddleSlim copied to clipboard
无法复现教程中的OCR v3检测模型的量化精度
我使用文档中:https://github.com/PaddlePaddle/PaddleSlim/tree/release/2.6/example/auto_compression/ocr的量化脚本进行量化,经过训练后模型的精度下降很大,请问我哪里做错了嘛?
精度的前后对比如下:
我使用的配置文件如下: Global: model_type: det model_dir: /share/disk3/xcq/02.model_cache/pretrain_models/ch_PP-OCRv3_det_infer_bak/ model_filename: inference.pdmodel params_filename: inference.pdiparams algorithm: DB
Distillation: alpha: 1.0 loss: l2
QuantAware: use_pact: true activation_bits: 8 is_full_quantize: false onnx_format: True activation_quantize_type: moving_average_abs_max weight_quantize_type: channel_wise_abs_max not_quant_pattern:
- skip_quant quantize_op_types:
- conv2d
- depthwise_conv2d weight_bits: 8
TrainConfig: epochs: 3 eval_iter: 200 learning_rate: type: CosineAnnealingDecay learning_rate: 0.00005 optimizer_builder: optimizer: type: Adam weight_decay: 5.0e-05
PostProcess: name: DBPostProcess thresh: 0.3 box_thresh: 0.6 max_candidates: 1000 unclip_ratio: 1.5
Metric: name: DetMetric main_indicator: hmean
Train: dataset: name: SimpleDataSet data_dir: /share/disk3/xcq/01.ImageData/010.OpenSourceData/icdar2015/text_localization/ label_file_list: - /share/disk3/xcq/01.ImageData/010.OpenSourceData/icdar2015/text_localization/train_icdar2015_label.txt ratio_list: [1.0] transforms: - DecodeImage: img_mode: BGR channel_first: false - DetLabelEncode: null - IaaAugment: augmenter_args: - type: Fliplr args: p: 0.5 - type: Affine args: rotate: - -10 - 10 - type: Resize args: size: - 0.5 - 3 - EastRandomCropData: size: - 960 - 960 max_tries: 50 keep_ratio: true - MakeBorderMap: shrink_ratio: 0.4 thresh_min: 0.3 thresh_max: 0.7 - MakeShrinkMap: shrink_ratio: 0.4 min_text_size: 8 - NormalizeImage: scale: 1./255. mean: - 0.485 - 0.456 - 0.406 std: - 0.229 - 0.224 - 0.225 order: hwc - ToCHWImage: null - KeepKeys: keep_keys: - image - threshold_map - threshold_mask - shrink_map - shrink_mask loader: shuffle: true drop_last: false batch_size_per_card: 4 num_workers: 0
Eval: dataset: name: SimpleDataSet data_dir: /share/disk3/xcq/01.ImageData/010.OpenSourceData/icdar2015/text_localization/ label_file_list: - /share/disk3/xcq/01.ImageData/010.OpenSourceData/icdar2015/text_localization/test_icdar2015_label.txt transforms: - DecodeImage: img_mode: BGR channel_first: false - DetLabelEncode: null - DetResizeForTest: null - NormalizeImage: scale: 1./255. mean: - 0.485 - 0.456 - 0.406 std: - 0.229 - 0.224 - 0.225 order: hwc - ToCHWImage: null - KeepKeys: keep_keys: - image - shape - polys - ignore_tags loader: shuffle: false drop_last: false batch_size_per_card: 1 num_workers: 0