google-coral / edgetpu

Coral issue tracker (and legacy Edge TPU API source)
https://coral.ai
Apache License 2.0
429 stars 125 forks source link

Segmentation fault when running example script or custom models on usb coral #821

Closed Skillnoob closed 10 months ago

Skillnoob commented 10 months ago

Description

After running the example script or ultralytics example i get a segmentation fault. I followed the installation instructions for the USB coral and did so multiple times making sure i had nothing wrong. It worked previously (few months ago) but does not anymore. Video of it working correctly:

https://github.com/google-coral/edgetpu/assets/78843978/81eed8f1-6162-4ccf-ba92-f46574829769

Some information about the setup: Os: Rasberry Pi Os Bullseye 64bit / Bookworm 64bit Device: Rasberry Pi 4B 2GB / Raspberry Pi 5 8GB tflite_runtime version: 2.10 until latest have been tested Python: 3.9.2 (Pi 4B) / 3.11.2 (Pi 5) (3.7.16 and 3.9.18 have also been tested through conda)

Ways to reproduce the issue: Run the detection example script from here.

Or follow these steps for a custom model:

$ pip install ultralytics

$ yolo export model=yolov8n.pt format=edgetpu

$ yolo detect val model=yolov8n_saved_model/yolov8n_full_integer_quant_edgetpu.tflite data=coco128.yaml batch=1
Click to expand! ### Issue Type Bug ### Operating System Linux ### Coral Device USB Accelerator ### Other Devices Rapsberry Pi 4 ### Programming Language Python 3.9, Other ### Relevant Log Output ```shell When run through gdb: Starting program: /usr/bin/python3 detect_image.py \ --model models/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite \ --labels models/coco_labels.txt \ --input images/grace_hopper.bmp \ --output images/grace_hopper_processed.bmp [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1". [New Thread 0x7ff547e1c0 (LWP 4159)] [New Thread 0x7ff4c7d1c0 (LWP 4160)] [New Thread 0x7ff047c1c0 (LWP 4161)] [New Thread 0x7fec6ee1c0 (LWP 4162)] [Thread 0x7fec6ee1c0 (LWP 4162) exited] [New Thread 0x7fec6ee1c0 (LWP 4163)] [Thread 0x7fec6ee1c0 (LWP 4163) exited] [New Thread 0x7fec6ee1c0 (LWP 4164)] [New Thread 0x7febeed1c0 (LWP 4165)] [New Thread 0x7feb6ec1c0 (LWP 4166)] [Thread 0x7feb6ec1c0 (LWP 4166) exited] [Thread 0x7febeed1c0 (LWP 4165) exited] [New Thread 0x7febeed1c0 (LWP 4167)] [New Thread 0x7feb6ec1c0 (LWP 4168)] [Thread 0x7feb6ec1c0 (LWP 4168) exited] [Thread 0x7febeed1c0 (LWP 4167) exited] [New Thread 0x7febeed1c0 (LWP 4185)] [New Thread 0x7feb6ec1c0 (LWP 4186)] [New Thread 0x7feaeeb1c0 (LWP 4187)] Thread 1 "python3" received signal SIGSEGV, Segmentation fault. 0x0000007fecb89350 in tflite::Subgraph::OpInit(TfLiteRegistration const&, char const*, unsigned long) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so Using backtrace from gdb: Thread 1 "python3" received signal SIGSEGV, Segmentation fault. 0x0000007fecb89350 in tflite::Subgraph::OpInit(TfLiteRegistration const&, char const*, unsigned long) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so (gdb) backtrace #0 0x0000007fecb89350 in tflite::Subgraph::OpInit(TfLiteRegistration const&, char const*, unsigned long) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so #1 0x0000007fecb8c4dc in tflite::Subgraph::AddNodeWithParameters(std::vector > const&, std::vector > const&, std::vector > const&, char const*, unsigned long, void*, TfLiteRegistration const*, int*) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so #2 0x0000007fecb8dc9c in tflite::Subgraph::ReplaceNodeSubsetsWithDelegateKernels(TfLiteRegistration, TfLiteIntArray const*, TfLiteDelegate*) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so #3 0x0000007fecb8df00 in tflite::Subgraph::ReplaceNodeSubsetsWithDelegateKernels(TfLiteContext*, TfLiteRegistration, TfLiteIntArray const*, TfLiteDelegate*) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so #4 0x0000007fec7cde24 in ?? () from /lib/aarch64-linux-gnu/libedgetpu.so.1 #5 0x0000007fecb8d668 in tflite::Subgraph::ModifyGraphWithDelegate(TfLiteDelegate*) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so #6 0x0000007fecc3d034 in tflite::Interpreter::ModifyGraphWithDelegateImpl(TfLiteDelegate*) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so #7 0x0000007fecb6c8a8 in tflite::interpreter_wrapper::InterpreterWrapper::ModifyGraphWithDelegate(TfLiteDelegate*) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so #8 0x0000007fecb73514 in pybind11::cpp_function::initialize(pybind11_init__pywrap_tensorflow_interpreter_wrapper(pybind11::module_&)::{lambda(tflite::interpreter_wrapper::InterpreterWrapper&, unsigned long)#24}&&, pybind11::object (*)(tflite::interpreter_wrapper::InterpreterWrapper&, unsigned long), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&, char const (&) [60])::{lambda(pybind11::detail::function_call&)#3}::_FUN(pybind11::detail::function_call&) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so #9 0x0000007fecb822d0 in pybind11::cpp_function::dispatcher(_object*, _object*, _object*) () from /home/pi/.local/lib/python3.9/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so #10 0x00000000004cac54 in ?? () #11 0x00000000004a5300 in _PyObject_MakeTpCall () #12 0x00000000004c6cc8 in ?? () #13 0x000000000049c258 in _PyEval_EvalFrameDefault () #14 0x00000000004964f8 in ?? () #15 0x00000000004b1d20 in _PyFunction_Vectorcall () #16 0x00000000004c1d88 in ?? () #17 0x00000000004a5180 in _PyObject_MakeTpCall () #18 0x000000000049ccf4 in _PyEval_EvalFrameDefault () #19 0x00000000004b1a48 in _PyFunction_Vectorcall () #20 0x0000000000498064 in _PyEval_EvalFrameDefault () #21 0x0000000000496b1c in ?? () #22 0x00000000004b1ca0 in _PyFunction_Vectorcall () #23 0x0000000000498064 in _PyEval_EvalFrameDefault () #24 0x00000000004964f8 in ?? () #25 0x0000000000496290 in _PyEval_EvalCodeWithName () #26 0x00000000005976fc in PyEval_EvalCode () #27 0x00000000005c850c in ?? () #28 0x00000000005c2520 in ?? () #29 0x00000000005c8458 in ?? () #30 0x00000000005c7c38 in PyRun_SimpleFileExFlags () #31 0x00000000005b7afc in Py_RunMain () #32 0x0000000000587638 in Py_BytesMain () #33 0x0000007ff7d00e18 in __libc_start_main (main=0x587538 <_start+56>, argc=10, argv=0x7ffffff118, init=, fini=, rtld_fini=, stack_end=) at ../csu/libc-start.c:308 #34 0x0000000000587534 in _start () Backtrace stopped: previous frame identical to this frame (corrupt stack?) ```
Skillnoob commented 10 months ago

This is now resolved due to the amazing work by feranic in #812 .

google-coral-bot[bot] commented 10 months ago

Are you satisfied with the resolution of your issue? Yes No