`convert_keras_model()` does not work as expected for BinaryDenseNet37 Dilated and XNORNet
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 258
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
I tried using python 3.6 + LCE 0.6.2 and python 3.7/3.8 + LCE 0.7.0 to run the following code, and the tflite file generated has unexpected sizes:
For python 3.6 + LCE 0.6.2:
XNOR tflite: 88.9 MB
BinaryDenseNet37 tflite: 25.6 MB
For python 3.7/3.8 + LCE 0.7.0:
XNOR tflite: 235.2 MB
BinaryDenseNet37 tflite: 5.4 MB (this looks normal)
Do you know what is causing this and what will be a solution? Thanks a lot!
import tensorflow as tf
import larq_zoo as lqz
import larq as lq
input_tensor = tf.keras.layers.Input(shape=(224, 224, 3))
# model = lqz.literature.BinaryDenseNet37Dilated(input_tensor=input_tensor, weights="imagenet")
model = lqz.literature.XNORNet(input_tensor=input_tensor, weights="imagenet")
lq.models.summary(model, print_fn=None, include_macs=True)
import os
path = os.path.join(os.getcwd(), './tflite_models')
if not os.path.exists(path):
os.makedirs(path)
with open(os.path.join(path,name+'.tflite'), 'wb') as flatbuffer_file:
flatbuffer_bytes = lce.convert_keras_model(model)
flatbuffer_file.write(flatbuffer_bytes)
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.
Research direction
Start by reproducing the reported convert_keras_model() results for XNORNet and BinaryDenseNet37Dilated across the listed Python and LCE versions. Compare the generated .tflite sizes with the reported values; done means identifying the cause of the discrepancy and documenting or implementing a verified solution.
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
- Needs clarification
- Newbie friendliness
- 25/100