Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFlite export wrong #974

Open
zhouhongbinboy opened this issue Jul 1, 2024 · 0 comments
Open

TFlite export wrong #974

zhouhongbinboy opened this issue Jul 1, 2024 · 0 comments

Comments

@zhouhongbinboy
Copy link

I want to export yolov8n.pt through TFLite, but encountered the following bug during the export process.
TensorFlow SavedModel: export failure ❌ 20.8s: cannot import name 'metadata_schema_py_generated' from 'tflite_support.metadata' (C:\conda\envs\yolov8\lib\site-packages\tflite_support\metadata.py)
Traceback (most recent call last):
File "c:\my_programm\yolov8\test.py", line 7, in
model.export(format="tflite") # creates 'yolov8n_float32.tflite'
File "C:\conda\envs\yolov8\lib\site-packages\ultralytics\engine\model.py", line 591, in export
return Exporter(overrides=args, _callbacks=self.callbacks)(model=self.model)
File "C:\conda\envs\yolov8\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\conda\envs\yolov8\lib\site-packages\ultralytics\engine\exporter.py", line 313, in call
f[5], keras_model = self.export_saved_model()
File "C:\conda\envs\yolov8\lib\site-packages\ultralytics\engine\exporter.py", line 142, in outer_func
raise e
File "C:\conda\envs\yolov8\lib\site-packages\ultralytics\engine\exporter.py", line 137, in outer_func
f, model = inner_func(*args, **kwargs)
File "C:\conda\envs\yolov8\lib\site-packages\ultralytics\engine\exporter.py", line 900, in export_saved_model
f.unlink() if "quant_with_int16_act.tflite" in str(f) else self._add_tflite_metadata(file)
File "C:\conda\envs\yolov8\lib\site-packages\ultralytics\engine\exporter.py", line 1024, in _add_tflite_metadata
from tflite_support.metadata import metadata_schema_py_generated as schema # noqa
ImportError: cannot import name 'metadata_schema_py_generated' from 'tflite_support.metadata' (C:\conda\envs\yolov8\lib\site-packages\tflite_support\metadata.py)
This is where the error occurred.
屏幕截图 2024-07-01 093653
But after I imported the same module in both branches, the bug was resolved.
屏幕截图 2024-07-01 094034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant