tensorflow / tensorflow/model-optimization

Post-training integer quantization for SSDMobileNet - poor detection accuracy

Open
#1,002 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.6k
Forks
349
Avg merge
3d 2h
Merged PRs (30d)
1

Description

Hi there

Describe the bug
I used Convert TF Object Detection API model to TFLite and tried to modify it, so it is fully int 8 quantized. Here is my version. It should completely run on its own in Colab.

In the notebook I use two different functions to create the different representative datasets. The first one uses 200 images from the coco dataset, the second one only 2. However, the resulting models seem to perform quite similarly poorly. Therefore I guess I did something wrong but can't find the mistake.

You can see the results of the models at the very end of the colab but I also will add some Screenshots.

System information

I didn't change the standard Installation on google Colab.

Python version:

Describe the expected behavior

The first generated tflite model should perform much better than the second and detect all easy cases.

Describe the current behavior
They both perform bad.

Code to reproduce the issue
Here is my version. It should completely run on its own on Colab.

Screenshots

Model 2 outperforms Model 1

Result Model 1

image

Result Model 2
image

Both perform okay

Result Model 1

image

Result Model 2

image

Both perform poorly

Result Model 1 & 2
image

Additional context
If you have any questions about my code don't hesitate to ask! Thank you very much.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked Colab notebook and compare the two representative-dataset paths used to produce the fully int8 TFLite SSDMobileNet models. Check the final model results against the reported screenshots; done means identifying and correcting the quantization workflow so the model using 200 COCO images performs as expected and the notebook remains reproducible in Colab.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.