problem with converted custom model at TensorFlow Lite #67086
Labels
comp:lite
TF Lite related issues
stale
This label marks the issue/pr stale - to be closed automatically if no activity
stat:awaiting response
Status - Awaiting response from author
TFLiteConverter
For issues related to TFLite converter
type:support
Support issues
I created a tflite model from yolov5n [export.py -- weights mymodel.pt -- include tflite] for the learning model I learned from yolov5n. By the way, /home/pi1/Desktop/project3/examples/lite/examples/object_detection/raspberry_pi. It works fine when I run the existing detect.py , but when I use the above model, I get the following error.
(0507) pi1@raspberrypi:~/Desktop/project3/examples/lite/examples/object_detection/raspberry_pi $ python detect.py --model mymodel.tflite
Traceback (most recent call last):
File "detect.py", line 15, in
import tensorflow_io as tfio
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_io/init.py", line 17, in
from tensorflow_io.python.api import * # pylint: disable=wildcard-import
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_io/python/api/init.py", line 19, in
from tensorflow_io.python.ops.io_dataset import IODataset
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_io/python/ops/init.py", line 24, in
import tensorflow as tf
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow/init.py", line 37, in
from tensorflow.python.tools import module_util as _module_util
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow/python/init.py", line 37, in
from tensorflow.python.eager import context
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow/python/eager/context.py", line 28, in
from tensorflow.core.framework import function_pb2
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow/core/framework/function_pb2.py", line 16, in
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in
from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 16, in
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 42, in
serialized_options=None, file=DESCRIPTOR),
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/google/protobuf/descriptor.py", line 561, in new
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
When I downgrade protobuf, I get the following error. Please solve the problem.
(0507) pi1@raspberrypi:~/Desktop/project3/examples/lite/examples/object_detection/raspberry_pi $ python detect.py --model mymodel.tflite
/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_io/python/ops/init.py:98: UserWarning: unable to load libtensorflow_io_plugins.so: unable to open file: libtensorflow_io_plugins.so, from paths: ['/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_io/python/ops/libtensorflow_io_plugins.so']
caused by: ['/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_io/python/ops/libtensorflow_io_plugins.so: undefined symbol: _ZN10tensorflow8internal15LogMessageFatalC1EPKci']
warnings.warn(f"unable to load libtensorflow_io_plugins.so: {e}")
/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_io/python/ops/init.py:104: UserWarning: file system plugins are not loaded: unable to open file: libtensorflow_io.so, from paths: ['/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_io/python/ops/libtensorflow_io.so']
caused by: ['/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_io/python/ops/libtensorflow_io.so: undefined symbol: _ZN10tensorflow4data11DatasetBase8FinalizeEPNS_15OpKernelContextESt8functionIFNS_8StatusOrISt10unique_ptrIS1_NS_4core15RefCountDeleterEEEEvEE']
warnings.warn(f"file system plugins are not loaded: {e}")
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
File "detect.py", line 152, in
main()
File "detect.py", line 148, in main
int(args.numThreads), bool(args.enableEdgeTPU))
File "detect.py", line 65, in run
detector = vision.ObjectDetector.create_from_options(options)
File "/home/pi1/miniconda3/envs/0507/lib/python3.7/site-packages/tensorflow_lite_support/python/task/vision/object_detector.py", line 91, in create_from_options
options.base_options.to_pb2(), options.detection_options.to_pb2())
RuntimeError: Input tensor has type kTfLiteFloat32: it requires specifying NormalizationOptions metadata to preprocess input images.
The text was updated successfully, but these errors were encountered: