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

[GSoC] Updates for Quantized models for QDQ method #266

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

jet981217
Copy link

@jet981217 jet981217 commented Jul 7, 2024

This PR updates several models using the QDQ (Quantization-During-Quantization) method. Models that showed sufficient performance with Per Tensor quantization were updated accordingly. For models where Per Tensor quantization did not yield satisfactory results, Per Channel quantization was used. Models lacking calibration data, sensitive to quantization, or having other issues were not updated.

Updated Models:

  • Face Detection (YuNet)
  • Face Recognition (SFace)
  • Facial Expression Recognition
  • Handpose Estimation (MediaPipe)
  • Human Segmentation (PP-HumanSeg)
  • Image Classification (MobileNet)
  • License Plate Detection (YuNet)
  • Object Detection (YOLOX)
  • Palm Detection (MediaPipe)
  • Person Re-identification (YoutureID)
  • Pose Estimation (MediaPipe)

This update aims to enhance model performance with efficient quantization methods where applicable. Models with significant issues were deferred for future updates.

Updates on OpenCV DNN is on the way for supporting QDQ.

@jet981217 jet981217 closed this Jul 7, 2024
@jet981217 jet981217 reopened this Jul 7, 2024
@jet981217 jet981217 changed the title Gsoc seungil cha [Gsoc] Updates for Quantized models for QDQ method Jul 7, 2024
@jet981217 jet981217 changed the title [Gsoc] Updates for Quantized models for QDQ method [GsoC] Updates for Quantized models for QDQ method Jul 7, 2024
Copy link
Member

@fengyuentau fengyuentau left a comment

Choose a reason for hiding this comment

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

We need to support qdq models first then we do the replacement. It also affects the tim-vx backend.

@fengyuentau fengyuentau added the GSoC Google Summer of Code projected related label Jul 8, 2024
@fengyuentau fengyuentau self-assigned this Jul 8, 2024
Copy link
Member

@fengyuentau fengyuentau left a comment

Choose a reason for hiding this comment

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

The quantization script also needs to be updated https://github.com/opencv/opencv_zoo/tree/main/tools/quantize

@jet981217
Copy link
Author

The quantization script also needs to be updated https://github.com/opencv/opencv_zoo/tree/main/tools/quantize

Thank you. I fixed it.

@jet981217
Copy link
Author

jet981217 commented Jul 8, 2024

We need to support qdq models first then we do the replacement. It also affects the tim-vx backend.

OK does this mean that I have to first fix & merge OpenCV DNN first, then merge this PR?

@jet981217 jet981217 changed the title [GsoC] Updates for Quantized models for QDQ method [GSoC] Updates for Quantized models for QDQ method Jul 8, 2024
@zihaomu
Copy link
Member

zihaomu commented Jul 8, 2024

Hi @jet981217, please keep the original quantized model, and add the suffix of _qdq for your qdq model.

@fengyuentau
Copy link
Member

Hi @jet981217, please keep the original quantized model, and add the suffix of _qdq for your qdq model.

I think we will move on with qdq model in the future. So no need to keep two copies of quantized models. We can have a discussion on this topic in weekly meeting.


Results of accuracy evaluation with [tools/eval](../../tools/eval).

| Models | Easy AP | Medium AP | Hard AP |
| ----------- | ------- | --------- | ------- |
| YuNet | 0.8871 | 0.8710 | 0.7681 |
| YuNet quant | 0.8838 | 0.8683 | 0.7676 |
| YuNet quant | 0.8809 | 0.8626 | 0.7493 |
Copy link
Member

@fengyuentau fengyuentau Jul 10, 2024

Choose a reason for hiding this comment

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

We should test models using opencv dnn and give result numbers. That is why we need qdq support first for dnn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC Google Summer of Code projected related need_discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants