Skip to content

MobileNetV3 quantization bug #5890

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

Open
datumbox opened this issue Apr 27, 2022 · 0 comments
Open

MobileNetV3 quantization bug #5890

datumbox opened this issue Apr 27, 2022 · 0 comments
Labels
bug module: models.quantization Issues related to the quantizable/quantized models

Comments

@datumbox
Copy link
Contributor

datumbox commented Apr 27, 2022

🐛 Describe the bug

This issue documents an bug discovered on February 2021 while quantizing the MobileNetV3. We worked around the issue but it probably remains unresolved on the eager quantization API. Here I'm gathering all the information exchanged with the quantization team so that we can investigate on the future.


TLDR: During the QAT training of MobileNetV3 the accuracies are at the expected levels. After serializing and loading the weights of the quantized weights, the accuracies appear similar to a randomly initialized model. The workaround is to instead load the QAT fine-tuned weights and convert the model.

Originally to quantize the MobileNetV3 Large we took the standard approach (see #3323). Our initial setup was extremely similar to the one of MobileNetV2. We trained a model with the reference script and we got good accuracies. Unfortunately when we tried to deploy the weights of the quantized model we found out that loading them and doing predictions leads to extremely low accuracy (less than 1%).

After trial and error, we found implemented the following workaround that allows to load the weights, quantize the model and get good accuracies: 274c6a1. Effectively we create a QAT model, load the fine-tuned weights and then quantize it.

The above workaround should be unnecessary. Instead MobileNetV3 should follow the same approach as with every other QAT model (such as in the case of MobileNetV2).

@datumbox datumbox added bug module: models.quantization Issues related to the quantizable/quantized models labels Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug module: models.quantization Issues related to the quantizable/quantized models
Projects
None yet
Development

No branches or pull requests

1 participant