tensorflow / tensorflow/models
CenterNet MobileNetV2 FPN 512x512 TFLite from Model Zoo doesn't work on Mobile GPU correctly
@pkulzc is already working on this.
Since Jun 10, 2021.
- 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
2. Describe the bug
A pre-trained TFLite model (model.tflite) from CenterNet MobileNetV2 FPN 512x512 (object detection) Model Zoo doesn't work correctly on Mobile GPU, although it's stated in Centernet_on_device.ipynb that it should work there.
- It works well on CPU (using either Object Detector Task API or TFLIte Inference API)
- When running on GPU via TFLIte Inference API (it looks like Java Task API doesn't support GPU delegate), the model is executed, but the output is invalid.
In particular, the returned scores are greater than 1.
Tried with various versions of org.tensorflow:tensorflow-lite-gpu including 0.0.0-nightly, 2.5.0, 2.4.0, 2.3.0, 2.2.0. Neither of them works correctly.
Tried various options for GPU delegate without any success. In particular, tried to set setPrecisionLossAllowed to false.
3. Steps to reproduce
- Download the TFLite model from http://download.tensorflow.org/models/object_detection/tf2/20210210/centernet_mobilenetv2fpn_512x512_coco17_od.tar.gz
- Run it on Mobile CPU in Java/Kotlin via TFLIte Inference API
- Run it on Mobile GPU in Java/Kotlin via TFLIte Inference API
- Compare results
4. Expected behavior
- The results on CPU and GPU should be the same
- The output scores are in [0,1] interval.
5. Additional context
The TFLite model works well and correctly on desktop (Ubuntu 20.04) in Python on both CPU and GPU.
6. System information
- OS Platform and Distribution: Android 27
- Mobile device name if the issue happens on a mobile device: AI Camera
- TensorFlow installed from (source or binary): binary
- TensorFlow version - tried multiple versions of
org.tensorflow:tensorflow-lite-gpuincluding 0.0.0-nightly, 2.5.0, 2.4.0, 2.3.0, 2.2.0. Neither of them works correctly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.