tensorflow / tensorflow/models

Objection Detection model conversion to TF Lite produces large files for many of the provided models

Open
#10,519 0 comments 0 reactions 3 assignees View on GitHub

@pkulzc is already working on this.

Since Mar 3, 2022.

models:research:odapi type:bug
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am using the latest TensorFlow Model Garden release and TensorFlow 2.
  • I am reporting the issue to the correct repository. (Model Garden official or research directory)
  • I checked to make sure that this issue has not already been filed.

1. The entire URL of the file you are using

N/A

2. Describe the bug

In the Object detection documentation it is noted that SSD models are supports for TF Lite conversion.
Looking at the code / issues it can be somewhat seen that other models e.g. CenterNet also has experimental support.
I downloaded a few of the pre-trained model and tried to convert them to TF Lite (SSD Resent, CenterNet Hourglass)
It seems that only SSD Mobilenet was converted without issues, the rest either failed or generated large files.

3. Steps to reproduce

Download pre-trained model and export using 'export_tflite_graph_tf2.py'
Convert to TFLite using python API, tried 3 different outputs, dynamic range, integer quantization with float fallback and full integer quantization.
SSD Mobilenet: generated TF lite files that were around 4 MB for all 3 conversions
SSD Resnet101: 70 Mb for all 3
CenterNet Hourglass: I forget what the error was but I could not get any output.
EfficientDet: I know it is not supported and is only handled through tflite model maker but the dynamic range tflite generation was OK with 11 Mb while the rest gave a warning from flatbuffer export that the Model was bigger than 2GB and stopped

4. Expected behavior

Conversion to TF Lite to work.
If only SSD Mobilenet is supposed to work the documentation should clearly state that.

5. Additional context

TF 2.8 SSD Resnet but is set up to easily test other models by chaning 2 variables
https://colab.research.google.com/drive/1nHWL9MaZ-em6gfKC8fBP4RnS9nQq4ZyP?usp=sharing

6. System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
  • Mobile device name if the issue happens on a mobile device:
  • TensorFlow installed from (source or binary): pip install
  • TensorFlow version (use command below): 2.8
  • Python version: 3.8.7
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.