oberluz / pycoral

Python API for ML inferencing and transfer-learning on Coral devices
https://coral.ai
Apache License 2.0
34 stars 2 forks source link

segmentation fault #13

Closed Jfilio closed 5 months ago

Jfilio commented 5 months ago

Describe the bug Hello, I have been trying to use the pycoral-2.13whl and the tflite_runtime-2.13whl with python3.11, and have been experiencing some issues as when I run the model I compiled myself or any of the examples from the pycoral website I get a segmentation fault, (env-pycoral) julien@raspberrypidrone:~/TensorFlow $ python3 tflitetest.py Segmentation fault

To Reproduce Steps to reproduce the behavior:

  1. Download pyenv then activate a virtual environment with python3.11.2, Follow the steps to download the libedgetpu library on the pycoral website, 1: Install the Edge TPU runtime
  2. download the tflite_runtime-2.13.0-cp311-cp311-linux_aarch64.whl, then download pycoral-2.13.0-cp311-cp311-linux_aarch64.whl
  3. Install what else is needed like opencv-python, matplotlib, etc
  4. run the bird example on the website or other models that interact with tflite/edgetpu

Expected behavior When using tflite2.5/its pycoral equivalent it would work fine providing how long it took, what bird it is, or if im using my own model it would draw a bounding box over me, but switching to this newer version gives the error

Desktop (please complete the following information):

Additional context Before I start I am pretty new to this, so if I did not include something please let me know. Running it with gdb shows this (Thread 1 "python" received signal SIGSEGV, Segmentation fault. 0x00007fffd6c14464 in tflite::Subgraph::OpInit(TfLiteRegistration const&, char const*, unsigned long) () from /home/julien/.pyenv/versions/3.11.2/envs/env-pycoral/lib/python3.11/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-311-aarch64-linux-gnu.so)

Jfilio commented 5 months ago

also using the bt command with gdb gives the following: (gdb) bt

0 0x00007fffd0124464 in tflite::Subgraph::OpInit(TfLiteRegistration const&, char const*, unsigned long) ()

from /home/julien/venv-pycoral/lib/python3.11/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-311-aarch64-linux-gnu.so

1 0x00007fffd0127cb4 in tflite::Subgraph::AddNodeWithParameters(std::vector<int, std::allocator > const&, std::vector<int, std::allocator > const&, std::vector<int, std::allocator > const&, char const, unsigned long, void, TfLiteRegistration const, int) ()

from /home/julien/venv-pycoral/lib/python3.11/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-311-aarch64-linux-gnu.so

2 0x00007fffd0128084 in tflite::Subgraph::ReplaceNodeSubsetsWithDelegateKernels(TfLiteRegistration, TfLiteIntArray const, TfLiteDelegate) ()

from /home/julien/venv-pycoral/lib/python3.11/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-311-aarch64-linux-gnu.so

3 0x00007fffd0128480 in tflite::Subgraph::ReplaceNodeSubsetsWithDelegateKernels(TfLiteContext, TfLiteRegistration, TfLiteIntArray const, TfLiteDelegate*) ()

from /home/julien/venv-pycoral/lib/python3.11/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-311-aarch64-linux-gnu.so

4 0x00007fffd024be24 in ?? () from /home/julien/coral/pycoral/libedgetpu_bin/throttled/aarch64/libedgetpu.so.1

5 0x00007fffd012924c in tflite::Subgraph::ModifyGraphWithDelegateImpl(TfLiteDelegate*) ()

from /home/julien/venv-pycoral/lib/python3.11/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-311-aarch64-linux-gnu.so

6 0x00007fffd0129f64 in tflite::Subgraph::ModifyGraphWithDelegate(TfLiteDelegate*) ()

from /home/julien/venv-pycoral/lib/python3.11/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-311-aarch64-linux-gnu.so

7 0x00007fffd0119d94 in tflite::impl::Interpreter::ModifyGraphWithDelegateImpl(TfLiteDelegate*) ()

from /home/julien/venv-pycoral/lib/python3.11/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-311-aarch64-linux-gnu.so

8 0x00007fffcfe32f70 in tflite::interpreter_wrapper::InterpreterWrapper::ModifyGraphWithDelegate(TfLiteDelegate*) ()

from /home/julien/venv-pycoral/lib/python3.11/site-packages/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.cpython-311-aarch64-linux-gnu.so

I could be wrong but maybe the seg fault is because of #4 0x00007fffd024be24 in ?? () from /home/julien/coral/pycoral/libedgetpu_bin/throttled/aarch64/libedgetpu.so.1, I will look for a more compatible version between the tflite.whl and libedgetpu1

Jfilio commented 5 months ago

hey, I got it working, so installing this version of libedgetpu gets rid of the seg fault and it runs super fast! https://github.com/feranick/libedgetpu/releases/download/v16.0tf2.13.1/libedgetpu1-std_16.0tf2.13.1.ubuntu22.04_arm64.deb