Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support weight quantization #2791

Merged
merged 24 commits into from
Feb 6, 2020

Conversation

juncaipeng
Copy link
Collaborator

@juncaipeng juncaipeng commented Jan 20, 2020

Fix #2809
Related paddle PR

Details:

  • add WeightQuantizationPreprocessPass to process scale, expand it to a list
  • update conv_bn_fuser to support weight quantization
  • transform weight from int8/16 to fp32 in light_api.cc

Base on 500 images, the test results are as follows:

model quantized op size top1 top5 top1 diff (int8/16-fp32) top5 diff (int8/16-fp32)
mobilenetv1 fp32 - 17M 73.8% 93.8%
mobilenetv1 int8 conv2d mul 4.6M 71.8% 92.6% -2.0% -1.2%
mobilenetv1 int16 conv2d mul 8.8 M 73.8% 93.8% 0% 0%
mobilenetv2 fp32 - 14.4M 75.6% 93.0%
mobilenetv2 int8 conv2d mul 4.2M 73.8% 93.0% -2.2% 0%
mobilenetv2 int16 conv2d mul 7.6M 75.6% 93.0% 0% 0%
resnet50 fp32 - 118.8M 79.4% 95.2%
resnet50 int8 conv2d mul 26.1M 78.8% 94.8% -0.6% -0.4%
resnet50 int16 conv2d mul 51.8M 79.4% 95.2% 0% 0%

@juncaipeng juncaipeng changed the title Support weight quant Support weight quantization Jan 20, 2020
@juncaipeng juncaipeng requested a review from NHZlX February 5, 2020 08:45
@yiicy yiicy self-requested a review February 6, 2020 05:24
Copy link
Collaborator

@yiicy yiicy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yiicy yiicy merged commit 6329a9a into PaddlePaddle:develop Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dev] PaddleLite支持无校准数据的训练后量化方法
3 participants