tensorflow / tensorflow/models
DeeplabV3 MobileNetV2 Quantization for USB Coral TPU with custom input size ((100, 100) rather than (513, 513))
@aquariusjay is already working on this.
Since May 12, 2020.
- Dominant language
- Python
- Stars
- 77.7k
- Forks
- 44.8k
- PR merge metrics
- No merged PRs in 30d
Description
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOS
- Mobile device (e.g., Pixel 4, Samsung Galaxy 10) if the issue happens on mobile device: Coral TPU
- TensorFlow installed from (source or binary): pip install tensorflow==1.15.0
- TensorFlow version (use command below):1.15.0
- Python version:3.7
- Bazel version (if compiling from source):
- GCC/Compiler version (if compiling from source):
- CUDA/cuDNN version: N/A
- GPU model and memory: N/A
Please provide the entire URL of the model you are using?
Describe the current behavior
Good Evening,
I have been following the steps in https://github.com/tensorflow/models/blob/394baa9f21424d3522ccfbdcee8acd3840891ff6/research/deeplab/g3doc/quantize.md to quantize a DeeplabV3 MobileNetV2 model for the USB Coral TPU but I cannot get it to work.
Even when I start from the models provided at the bottom (not the 8_bits, the raw models), I cannot get it to run. And I even get different problem for both models.
For the deeplabv3_mnv2_pascal_train_aug:
- The
deeplab/train.pyscript for quantizing runs successfully. - The
deeplab/export_model.pyscripts step works. - The
tflite_convertworks too. - EdgeTPU compiler gets cryptic error message:
Internal compiler error. Aborting!
For the deeplabv3_mnv2_dm05_pascal_trainaug:
-
The
deeplab/train.pyscript for quantizing runs gets:
ValueError: Total size of new array must be unchanged for MobilenetV2/Conv/weights lh_shape: [(3, 3, 3, 16)], rh_shape: [(3, 3, 3, 32)]
I tried this solution unsuccessfully. -
Using the .pb file directly, the
deeplab/train.pywith quantization aware training fails with python crashing. -
Doing a post-quantization in python directly works.
-
edgetpu_compiler works.
-
But once ran on the TPU, we get 0.87 TPS, most likely because the edgetpu-converter cannot convert all to edgtpu.
Any guidance to get it working would be great. I am also open to solutions not following the guide from tensorflow.
Describe the expected behavior
It should not crash.
Code to reproduce the issue
Take the 2 models at the bottom of the https://github.com/tensorflow/models/blob/394baa9f21424d3522ccfbdcee8acd3840891ff6/research/deeplab/g3doc/quantize.md page (not the 8_bits one) and try to quantize them following the guide and run them on an USB Coral Edge TPU.
Other info / logs
See above
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.