Tensorflow Lite Export Produces Model Error
Closed this issue · 2 comments
jeffMeador commented
This issue is for a: (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
- Create new project with domain General (compact) or General (compact) S1
- Train model using Quick Training
- Export TensorFlow Lite model
- Test model using the sample code in this repo https://github.com/Azure-Samples/customvision-export-samples/blob/main/samples/python/tensorflow_lite/classification/predict.py
Any log messages given by the failure
This is the error provided:
Traceback (most recent call last):
File "predict.py", line 47, in <module>
main()
File "predict.py", line 41, in main
model = Model(args.model_filepath)
File "predict.py", line 10, in __init__
self.interpreter = tensorflow.lite.Interpreter(model_path=str(model_filepath))
File "/Users/{username}/anaconda3/lib/python3.8/site-packages/tensorflow/lite/python/interpreter.py", line 463, in __init__
_interpreter_wrapper.CreateWrapperFromFile(
ValueError: Model provided has model identifier '
I also tried adjusting the code to use the tflite runtime instead and it produced the same error:
Traceback (most recent call last):
File "predict.py", line 47, in <module>
main()
File "predict.py", line 41, in main
model = Model(args.model_filepath)
File "predict.py", line 10, in __init__
self.interpreter = tflite.Interpreter(model_path=str(model_filepath))
File "/Users/{username}/anaconda3/lib/python3.8/site-packages/tflite_runtime/interpreter.py", line 348, in __init__
_interpreter_wrapper.CreateWrapperFromFile(
ValueError: Model provided has model identifier '
Expected/desired behavior
Output of predicted tag
OS and Version?
macOS 10.15.7
python 3.8.12
tensorflow 2.7.0
tflite-runtime 2.5.0.post1
shonohs commented
Thanks for the feedback.
The script expects a *.tflite model file. Please make sure to extract a tflite file from the zip file downloaded from Custom Vision service.
jeffMeador commented
Thanks @shonohs that works.