Skip to content

量化ch_PP-OCRv4_det后导出报错 #1884

@aijim

Description

@aijim

环境:
Ubantu 20.04
paddlepaddle-gpu 2.6.1
paddleslim 2.3.2

你好!
我用quant.py量化ch_PP-OCRv4_det后,用export_model.py导出模型的时候出错。好像是每层Conv2D都加了一层MAOutputScaleLayer,而export_model.py期望不加MAOutputScaleLayer的Conv2D层。有解决的方法么?

Traceback (most recent call last):
  File "/home/shui/ascent-paddleocr/deploy/slim/quantization/export_model.py", line 179, in <module>
    main()
  File "/home/shui/ascent-paddleocr/deploy/slim/quantization/export_model.py", line 173, in main
    export_single_model(model, arch_config, save_path, logger, input_shape,
  File "/home/shui/ascent-paddleocr/tools/export_model.py", line 196, in export_single_model
    layer.rep()
  File "/home/shui/ascent-paddleocr/ppocr/modeling/backbones/rec_lcnetv3.py", line 201, in rep
    kernel, bias = self._get_kernel_bias()
  File "/home/shui/ascent-paddleocr/ppocr/modeling/backbones/rec_lcnetv3.py", line 220, in _get_kernel_bias
    kernel_conv_1x1, bias_conv_1x1 = self._fuse_bn_tensor(self.conv_1x1)
  File "/home/shui/ascent-paddleocr/ppocr/modeling/backbones/rec_lcnetv3.py", line 244, in _fuse_bn_tensor
    kernel = branch.conv.weight
  File "/home/shui/.local/lib/python3.10/site-packages/paddle/nn/layer/layers.py", line 1657, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'MAOutputScaleLayer' object has no attribute 'weight'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions