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

[YOLOv5] Yolov5 shows zero accuracy after quantization #318

Closed
Corallo opened this issue Apr 18, 2023 · 2 comments
Closed

[YOLOv5] Yolov5 shows zero accuracy after quantization #318

Corallo opened this issue Apr 18, 2023 · 2 comments
Labels
Quantization Quantization

Comments

@Corallo
Copy link

Corallo commented Apr 18, 2023

Issue Type

Others

onnx2tf version number

1.9.6

onnx version number

1.13.0

tensorflow version number

2.11.0

Download URL for ONNX

https://mega.nz/folder/PBshwDga#KwqmDZScWLIhdqOb9sqgzg

Parameter Replacement JSON

I don't know where to get this JSON

Description

  1. I am trying to develop a guide about deploying a model on an edge device that needs model quantized by tensor. The quantization is the main blocking part.
  2. No errors, I am using a custom yolov5 (the custom part is simply the relu activation), exported to onnx, and then converted to tflite with onnx2tf, with the command onnx2tf -i ./fully_trained_normal.onnx -oiqt -qt per-tensor -ioqd uint8 then I am running the yolov5 eval script python3 val.py --weights fully_trained_normal_integer_quant.tflite . While running the eval script on the onnx model produces a map score of ~0.44, I get 0 with the quantized model. I was wondering if you know I am doing something obviously wrong that I am not aware of.
  3. Checked the quantized model on netron, it looks all right, I tried with some of the other quantized version of the model that have both filter and bias of the convolution quantized as int8, same problem apply, I tried also to export to both int8 and uint8. Checked on this repo closed issues, didn't find similar problems.
  4. To obtain a working model for the edge device
  5. I linked a mega folder with the onnx model and the tflite converted version.

Any suggestion would be appreciated :)

@PINTO0309
Copy link
Owner

PINTO0309 commented Apr 18, 2023

Duplicate of #244 , #263, #269

image

@PINTO0309 PINTO0309 changed the title Yolov5 shows zero accuracy after quantization [YOLOv5] Yolov5 shows zero accuracy after quantization Apr 18, 2023
@PINTO0309 PINTO0309 added the Quantization Quantization label Apr 18, 2023
@Corallo
Copy link
Author

Corallo commented Jun 21, 2023

I see, looking at those other issues, I understand it is an architecture problem that doesn't support well by design the quantization by tensor.
Do you have a suggestion about object detection model that don't have this issue with quantization by tensor?
I've seen your model zoo, but there I don't see any indication of which model might have this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Quantization Quantization
Projects
None yet
Development

No branches or pull requests

2 participants