hunglc007 / tensorflow-yolov4-tflite

YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
https://github.com/hunglc007/tensorflow-yolov4-tflite
MIT License
2.23k stars 1.24k forks source link

ERROR:converting yolo4.weights to yolo4.tflite #294

Open cymqqqq opened 3 years ago

cymqqqq commented 3 years ago

loc("batch_normalization/moving_mean"): error: is not immutable, try running tf-saved-model-optimize-global-tensors to prove tensors are immutable Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/tensorflow/lite/python/convert.py", line 210, in toco_convert_protos model_str = wrap_toco.wrapped_toco_convert(model_flags_str, File "/usr/local/lib/python3.8/dist-packages/tensorflow/lite/python/wrap_toco.py", line 32, in wrapped_toco_convert return _pywrap_toco_api.TocoConvert( Exception: :0: error: loc("batch_normalization/moving_mean"): is not immutable, try running tf-saved-model-optimize-global-tensors to prove tensors are immutable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "convert_tflite.py", line 76, in app.run(main) File "/usr/local/lib/python3.8/dist-packages/absl/app.py", line 303, in run _run_main(main, args) File "/usr/local/lib/python3.8/dist-packages/absl/app.py", line 251, in _run_main sys.exit(main(argv)) File "convert_tflite.py", line 71, in main save_tflite() File "convert_tflite.py", line 45, in save_tflite tflite_model = converter.convert() File "/usr/local/lib/python3.8/dist-packages/tensorflow/lite/python/lite.py", line 739, in convert result = _convert_saved_model(**converter_kwargs) File "/usr/local/lib/python3.8/dist-packages/tensorflow/lite/python/convert.py", line 632, in convert_saved_model data = toco_convert_protos( File "/usr/local/lib/python3.8/dist-packages/tensorflow/lite/python/convert.py", line 216, in toco_convert_protos raise ConverterError(str(e)) tensorflow.lite.python.convert.ConverterError: :0: error: loc("batch_normalization/moving_mean"): is not immutable, try running tf-saved-model-optimize-global-tensors to prove tensors are immutable

istomoya commented 3 years ago

Maybe discussed in https://github.com/hunglc007/tensorflow-yolov4-tflite/issues/285 I met the same error "tensorflow.lite.python.convert.ConverterError" on Tensorflow 2.4.0. Worked on Tensorflow 2.3.0.