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

Error encountered when trying to use Google Coral accelerator #37

Closed
GBW48 opened this issue Jun 24, 2020 · 6 comments
Closed

Error encountered when trying to use Google Coral accelerator #37

GBW48 opened this issue Jun 24, 2020 · 6 comments

Comments

@GBW48
Copy link

GBW48 commented Jun 24, 2020

  • rpi-deep-pantilt version: v1.2.0
  • Python version: 3.7.3
  • TensorFlow version: 2.2
  • Operating System: Raspbian 10 (buster), running on a 4 gig Raspberry Pi 4

Description

Object detection using Google Coral accelerator (following README.md instructions for rpi-deep-pantilt version 1.2) fails and does not display image. Please note standard object detection without using the accelerator works ("rpi-deep-pantilt detect --rotation 180"). I repeated the deep-pan-tilt build and object detection twice -- with the same result.

When I issue "rpi-deep-pantilt detect --edge-tpu --rotation 180", I get two errors with no image displayed on the RPi.

Fist error:

Traceback (most recent call last):
File "/home/pi/.venv/bin/rpi-deep-pantilt", line 10, in
sys.exit(main())
File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/cli.py", line 172, in main
cli()
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/cli.py", line 96, in detect
run_stationary_detect(labels, model_cls, rotation)
File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/detect/camera.py", line 80, in run_stationary_detect
model = model_cls()
File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/detect/ssd_mobilenet_v3_coco.py", line 65, in init
tf.lite.experimental.load_delegate(self.EDGETPU_SHARED_LIB)
File "/home/pi/.venv/lib/python3.7/site-packages/tensorflow/lite/python/interpreter.py", line 161, in load_delegate
delegate = Delegate(library, options)
File "/home/pi/.venv/lib/python3.7/site-packages/tensorflow/lite/python/interpreter.py", line 90, in init
self._library = ctypes.pydll.LoadLibrary(library)
File "/usr/lib/python3.7/ctypes/init.py", line 434, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.7/ctypes/init.py", line 356, in init
self._handle = _dlopen(self._name, mode)
OSError: libedgetpu.so.1: cannot open shared object file: No such file or directory
Exception ignored in: <function Delegate.del at 0xa5f3bfa8>

Second error:

Traceback (most recent call last):
File "/home/pi/.venv/lib/python3.7/site-packages/tensorflow/lite/python/interpreter.py", line 125, in del
if self._library is not None:
AttributeError: 'Delegate' object has no attribute '_library'

What I Did

I freshly installed Raspbian 10 (buster) on a high speed 32 gig SD card. I then followed the README.md instructions. I only had one issue after issuing the "pip install https://github.com/leigh-johnson/Tensorflow-bin/releases/download/v2.2.0/tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl" command.

Here is the error:

Building wheels for collected packages: grpcio
Running setup.py bdist_wheel for grpcio ... error
Complete output from command /home/pi/.venv/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-tjyl9jcz/grpcio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/pip-wheel-okaw4p5s --python-tag cp37:
Found cython-generated files...
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help

error: invalid command 'bdist_wheel'


Failed building wheel for grpcio
Running setup.py clean for grpcio
Failed to build grpcio

Otherwise, I encountered no problems with the install. Please note, I was careful to make all recommended changes config.txt and Raspberry Pi interfaces.

@leigh-johnson
Copy link
Member

leigh-johnson commented Jun 25, 2020

Thanks for the bug report @GBW48, sorry this didn't work for you!

Looks like your TensorFlow installation didn't finish because you don't have the wheel Python package installed. I think my Coral installation instructions are out of date too. Try the following to re-install, let me know how it goes. 🤞

  1. Install wheel and reinstall TensorFlow

(.venv)$ pip install wheel && pip install --force-reinstall https://github.com/leigh-johnson/Tensorflow-bin/releases/download/v2.2.0/tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl

  1. Install/reinstall Coral's libedgetpu.
$ echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list

$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install libedgetpu1-std
  1. Re-install Coral's tflite_runtime

(.venv)$ pip install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-linux_armv7l.whl

@GBW48
Copy link
Author

GBW48 commented Jun 25, 2020

Hi Leigh, Thanks so much for the quick response. With your suggested changes, I am still getting run-time errors and I'm unable to display objects using the Coral accelerator.

I tried your suggestions on a fresh build. The wheel and TensorFlow installation appeared to work. Here are the results of the install.

(.venv) pi@raspberrypi:~ $ pip install wheel
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting wheel
Downloading https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb5 9009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Installing collected packages: wheel
Successfully installed wheel-0.34.2
(.venv) pi@raspberrypi:~ $
(.venv) pi@raspberrypi:~ $ pip install --force-reinstall https://github.com/leig h-johnson/Tensorflow-bin/releases/download/v2.2.0/tensorflow-2.2.0-cp37-cp37m-li nux_armv7l.whl
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting tensorflow==2.2.0 from https://github.com/leigh-johnson/Tensorflow-bi n/releases/download/v2.2.0/tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl
Downloading https://github.com/leigh-johnson/Tensorflow-bin/releases/download/ v2.2.0/tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl (109.3MB)
100% |████████████████████████████████| 109.3MB 4.0kB/s
Collecting astunparse==1.6.3 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/2b/03/13dde6512ad7b4557eb7 92fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl
Collecting six>=1.12.0 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729f e4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting absl-py>=0.7.0 (from tensorflow==2.2.0)
Downloading https://www.piwheels.org/simple/absl-py/absl_py-0.9.0-py3-none-any .whl (121kB)
100% |████████████████████████████████| 122kB 455kB/s
Collecting termcolor>=1.1.0 (from tensorflow==2.2.0)
Downloading https://www.piwheels.org/simple/termcolor/termcolor-1.1.0-py3-none -any.whl
Collecting grpcio>=1.8.6 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/5e/29/1bd649737e427a6bb850 174293b4f2b72ab80dd49462142db9b81e1e5c7b/grpcio-1.30.0.tar.gz (19.7MB)
100% |████████████████████████████████| 19.7MB 23kB/s
Collecting wheel>=0.26; python_version >= "3" (from tensorflow==2.2.0)
Using cached https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb 59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Collecting google-pasta>=0.1.8 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/a3/de/c648ef6835192e6e2cc0 3f40b19eeda4382c49b5bafb43d88b931c4c74ac/google_pasta-0.2.0-py3-none-any.whl (57 kB)
100% |████████████████████████████████| 61kB 1.9MB/s
Collecting keras-preprocessing>=1.1.0 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/79/4c/7c3275a01e12ef9368a8 92926ab932b33bb13d55794881e3573482b378a7/Keras_Preprocessing-1.1.2-py2.py3-none- any.whl (42kB)
100% |████████████████████████████████| 51kB 4.2MB/s
Collecting protobuf>=3.8.0 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/47/90/27eac528bb6871336e86 ed8bcbb72a9b412a4020bf69bb7be71d40e5eab0/protobuf-3.12.2-py2.py3-none-any.whl (4 43kB)
100% |████████████████████████████████| 450kB 985kB/s
Collecting tensorflow-estimator<2.3.0,>=2.2.0 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/a4/f5/926ae53d6a226ec0fda5 208e0e581cffed895ccc89e36ba76a8e60895b78/tensorflow_estimator-2.2.0-py2.py3-none -any.whl (454kB)
100% |████████████████████████████████| 460kB 977kB/s
Collecting wrapt>=1.11.1 (from tensorflow==2.2.0)
Downloading https://www.piwheels.org/simple/wrapt/wrapt-1.12.1-cp37-cp37m-linu x_armv7l.whl (68kB)
100% |████████████████████████████████| 71kB 318kB/s
Collecting scipy==1.4.1; python_version >= "3" (from tensorflow==2.2.0)
Downloading https://www.piwheels.org/simple/scipy/scipy-1.4.1-cp37-cp37m-linux armv7l.whl (50.7MB)
100% |████████████████████████████████| 50.7MB 9.2kB/s
Collecting opt-einsum>=2.3.2 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/63/a5/e6c07b08b934831ccb8c 98ee335e66b7761c5754ee3cabfe4c11d0b1af28/opt_einsum-3.2.1-py3-none-any.whl (63kB )
100% |████████████████████████████████| 71kB 4.0MB/s
Collecting h5py<2.11.0,>=2.10.0 (from tensorflow==2.2.0)
Downloading https://www.piwheels.org/simple/h5py/h5py-2.10.0-cp37-cp37m-linux
armv7l.whl (4.7MB)
100% |████████████████████████████████| 4.7MB 98kB/s
Collecting numpy<2.0,>=1.16.0 (from tensorflow==2.2.0)
Downloading https://www.piwheels.org/simple/numpy/numpy-1.19.0-cp37-cp37m-linu x_armv7l.whl (10.5MB)
100% |████████████████████████████████| 10.5MB 33kB/s
Collecting gast==0.3.3 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/d6/84/759f5dd23fec8ba71952 d97bcc7e2c9d7d63bdc582421f3cd4be845f0c98/gast-0.3.3-py2.py3-none-any.whl
Collecting tensorboard<2.3.0,>=2.2.0 (from tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/1d/74/0a6fcb206dcc72a6da9a 62dd81784bfdbff5fedb099982861dc2219014fb/tensorboard-2.2.2-py3-none-any.whl (3.0 MB)
100% |████████████████████████████████| 3.0MB 151kB/s
Collecting setuptools (from protobuf>=3.8.0->tensorflow==2.2.0)
Using cached https://files.pythonhosted.org/packages/e9/93/4860cebd5ad3ff2664a d3c966490ccb46e3b88458b2095145bca11727ca4/setuptools-47.3.1-py3-none-any.whl
Collecting google-auth-oauthlib<0.5,>=0.4.1 (from tensorboard<2.3.0,>=2.2.0->ten sorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/7b/b8/88def36e74bee9fce511 c9519571f4e485e890093ab7442284f4ffaef60b/google_auth_oauthlib-0.4.1-py2.py3-none -any.whl
Collecting markdown>=2.6.8 (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/a4/63/eaec2bd025ab48c754b5 5e8819af0f6a69e2b1e187611dd40cbbe101ee7f/Markdown-3.2.2-py3-none-any.whl (88kB)
100% |████████████████████████████████| 92kB 3.7MB/s
Collecting requests<3,>=2.21.0 (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2. 0)
Downloading https://files.pythonhosted.org/packages/45/1e/0c169c6a5381e241ba74 04532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl (6 1kB)
100% |████████████████████████████████| 71kB 4.1MB/s
Collecting tensorboard-plugin-wit>=1.6.0 (from tensorboard<2.3.0,>=2.2.0->tensor flow==2.2.0)
Downloading https://files.pythonhosted.org/packages/51/cd/a0c1f9e4582ea64dddf7 6c1b808b318d01e3b858a51c715bffab1016ecc7/tensorboard_plugin_wit-1.6.0.post3-py3- none-any.whl (777kB)
100% |████████████████████████████████| 778kB 573kB/s
Collecting werkzeug>=0.11.15 (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/cc/94/5f7079a0e00bd6863ef8 f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (29 8kB)
100% |████████████████████████████████| 307kB 1.5MB/s
Collecting google-auth<2,>=1.6.3 (from tensorboard<2.3.0,>=2.2.0->tensorflow==2. 2.0)
Downloading https://files.pythonhosted.org/packages/21/57/d706964a7e4056f3f224 4e16705388c11631fbb53d3e2d2a2d0fbc24d470/google_auth-1.18.0-py2.py3-none-any.whl (90kB)
100% |████████████████████████████████| 92kB 3.6MB/s
Collecting requests-oauthlib>=0.7.0 (from google-auth-oauthlib<0.5,>=0.4.1->tens orboard<2.3.0,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/a3/12/b92740d845ab62ea4edf 04d2f4164d82532b5a0b03836d4d4e71c6f3d379/requests_oauthlib-1.3.0-py2.py3-none-an y.whl
Collecting importlib-metadata; python_version < "3.8" (from markdown>=2.6.8->ten sorboard<2.3.0,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/98/13/a1d703ec396ade42c1d3 3df0e1cb691a28b7c08b336a5683912c87e04cd7/importlib_metadata-1.6.1-py2.py3-none-a ny.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests<3,>=2.21.0->te nsorboard<2.3.0,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/e1/e5/df302e8017440f111c11 cc41a6b432838672f5a70aa29227bf58149dc72f/urllib3-1.25.9-py2.py3-none-any.whl (12 6kB)
100% |████████████████████████████████| 133kB 3.2MB/s
Collecting certifi>=2017.4.17 (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2 .0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226 f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl (156kB)
100% |████████████████████████████████| 163kB 2.6MB/s
Collecting chardet<4,>=3.0.2 (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2. 0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b648 7b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133 kB)
100% |████████████████████████████████| 143kB 3.1MB/s
Collecting idna<3,>=2.5 (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2.0->te nsorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/89/e3/afebe61c546d18fb1709 a61bee788254b40e736cff7271c7de5de2dc4128/idna-2.9-py2.py3-none-any.whl (58kB)
100% |████████████████████████████████| 61kB 3.7MB/s
Collecting cachetools<5.0,>=2.0.0 (from google-auth<2,>=1.6.3->tensorboard<2.3.0 ,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/b3/59/524ffb454d05001e2be7 4c14745b485681c6ed5f2e625f71d135704c0909/cachetools-4.1.0-py3-none-any.whl
Collecting pyasn1-modules>=0.2.1 (from google-auth<2,>=1.6.3->tensorboard<2.3.0, >=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/95/de/214830a981892a3e286c 3794f41ae67a4495df1108c3da8a9f62159b9a9d/pyasn1_modules-0.2.8-py2.py3-none-any.w hl (155kB)
100% |████████████████████████████████| 163kB 2.7MB/s
Collecting rsa<5,>=3.1.4; python_version >= "3" (from google-auth<2,>=1.6.3->ten sorboard<2.3.0,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/1c/df/c3587a667d6b308fadc9 0b99e8bc8774788d033efcc70f4ecaae7fad144b/rsa-4.6-py3-none-any.whl (47kB)
100% |████████████████████████████████| 51kB 3.8MB/s
Collecting oauthlib>=3.0.0 (from requests-oauthlib>=0.7.0->google-auth-oauthlib< 0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/05/57/ce2e7a8fa7c0afb54a05 81b14a65b56e62b5759dbc98e80627142b8a3704/oauthlib-3.1.0-py2.py3-none-any.whl (14 7kB)
100% |████████████████████████████████| 153kB 2.7MB/s
Collecting zipp>=0.5 (from importlib-metadata; python_version < "3.8"->markdown> =2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/b2/34/bfcb43cc0ba81f527bc4 f40ef41ba2ff4080e047acb0586b56b3d017ace4/zipp-3.1.0-py3-none-any.whl
Collecting pyasn1<0.5.0,>=0.4.6 (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6 .3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0)
Downloading https://files.pythonhosted.org/packages/62/1e/a94a8d635fa3ce4cfc7f 506003548d0a2447ae76fd5ca53932970fe3053f/pyasn1-0.4.8-py2.py3-none-any.whl (77kB )
100% |████████████████████████████████| 81kB 3.7MB/s
Building wheels for collected packages: grpcio
Running setup.py bdist_wheel for grpcio ... done
Stored in directory: /home/pi/.cache/pip/wheels/1e/e9/13/2ce6c99171a977bad2f9a 4bccfa596a6e7ea060b9fbff51bc3
Successfully built grpcio
Installing collected packages: wheel, six, astunparse, absl-py, termcolor, grpci o, google-pasta, numpy, keras-preprocessing, setuptools, protobuf, tensorflow-es timator, wrapt, scipy, opt-einsum, h5py, gast, cachetools, pyasn1, pyasn1-module s, rsa, google-auth, urllib3, certifi, chardet, idna, requests, oauthlib, reques ts-oauthlib, google-auth-oauthlib, zipp, importlib-metadata, markdown, tensorboa rd-plugin-wit, werkzeug, tensorboard, tensorflow
Found existing installation: wheel 0.34.2
Uninstalling wheel-0.34.2:
Successfully uninstalled wheel-0.34.2
Found existing installation: setuptools 47.3.1
Uninstalling setuptools-47.3.1:
Successfully uninstalled setuptools-47.3.1
Successfully installed absl-py-0.9.0 astunparse-1.6.3 cachetools-4.1.0 certifi-2 020.6.20 chardet-3.0.4 gast-0.3.3 google-auth-1.18.0 google-auth-oauthlib-0.4.1 google-pasta-0.2.0 grpcio-1.30.0 h5py-2.10.0 idna-2.9 importlib-metadata-1.6.1 k eras-preprocessing-1.1.2 markdown-3.2.2 numpy-1.19.0 oauthlib-3.1.0 opt-einsum-3 .2.1 protobuf-3.12.2 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.24.0 requests- oauthlib-1.3.0 rsa-4.6 scipy-1.4.1 setuptools-47.3.1 six-1.15.0 tensorboard-2.2. 2 tensorboard-plugin-wit-1.6.0.post3 tensorflow-2.2.0 tensorflow-estimator-2.2.0 termcolor-1.1.0 urllib3-1.25.9 werkzeug-1.0.1 wheel-0.34.2 wrapt-1.12.1 zipp-3. 1.0
(.venv) pi@raspberrypi:~ $

The install of Coral's libedgetpu appears to have errors. Here are the results of the install.

.venv) pi@raspberrypi:~ $
(.venv) pi@raspberrypi:~ $ echo "deb https://packages.cloud.google.com/apt coral -edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
deb https://packages.cloud.google.com/apt coral-edgetpu-stable main
(.venv) pi@raspberrypi:~ $
(.venv) pi@raspberrypi:~ $ curl https://packages.cloud.google.com/apt/doc/apt-ke y.gpg | sudo apt-key add -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1461 100 1461 0 0 9938 0 --:--:-- --:--:-- --:--:-- 10006
gpg: no valid OpenPGP data found.
(.venv) pi@raspberrypi:~ $
(.venv) pi@raspberrypi:~ $ sudo apt-get update
Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Get:3 https://packages.cloud.google.com/apt coral-edgetpu-stable InRelease [6,33 2 B]
Err:3 https://packages.cloud.google.com/apt coral-edgetpu-stable InRelease
The following signatures couldn't be verified because the public key is not av ailable: NO_PUBKEY 6A030B21BA07F4FB
Reading package lists... Done
W: GPG error: https://packages.cloud.google.com/apt coral-edgetpu-stable InRelea se: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
E: The repository 'https://packages.cloud.google.com/apt coral-edgetpu-stable In Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disa bled by default.
N: See apt-secure(8) manpage for repository creation and user configuration deta ils.
(.venv) pi@raspberrypi:~ $
(.venv) pi@raspberrypi:~ $ sudo apt-get install libedgetpu1-std
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libedgetpu1-std
(.venv) pi@raspberrypi:~ $

The install or Coral's tflite_runtime appeared to work. Here are the results of the install.

(.venv) pi@raspberrypi:~ $
(.venv) pi@raspberrypi:~ $ pip install https://dl.google.com/coral/python/tflite _runtime-2.1.0.post1-cp37-cp37m-linux_armv7l.whl
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting tflite-runtime==2.1.0.post1 from https://dl.google.com/coral/python/t flite_runtime-2.1.0.post1-cp37-cp37m-linux_armv7l.whl
Downloading https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37 -cp37m-linux_armv7l.whl (1.8MB)
100% |████████████████████████████████| 1.8MB 231kB/s
Requirement already satisfied: numpy>=1.12.1 in ./.venv/lib/python3.7/site-packa ges (from tflite-runtime==2.1.0.post1) (1.19.0)
Installing collected packages: tflite-runtime
Successfully installed tflite-runtime-2.1.0.post1
(.venv) pi@raspberrypi:~ $

I confirmed that object detection using the "rpi-deep-pantilt detect --rotation 180" command worked.
However, when I ran "rpi-deep-pantilt detect --rotation 180 --edge-tpu" the command failed with two errors:

  • "OSError: libedgetpu.so.1: cannot open shared object file: No such file or directory"
  • AttributeError: 'Delegate' object has no attribute '_library

Here is the console log when I tried to use the Coral accelerator.

(.venv) pi@raspberrypi:~ $
(.venv) pi@raspberrypi:~ $ rpi-deep-pantilt detect --rotation 180 --edge-tpu
WARNING:root:Detecting labels: ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush']
Downloading data from https://github.com/leigh-johnson/rpi-deep-pantilt/releases/download/v1.0.0/ssdlite_mobilenet_edgetpu_coco_quant.tar.gz
81715200/81713258 [==============================] - 3s 0us/step
Traceback (most recent call last):
File "/home/pi/.venv/bin/rpi-deep-pantilt", line 10, in
sys.exit(main())
File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/cli.py", line 172, in main
cli()
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/cli.py", line 96, in detect
run_stationary_detect(labels, model_cls, rotation)
File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/detect/camera.py", line 80, in run_stationary_detect
model = model_cls()
File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/detect/ssd_mobilenet_v3_coco.py", line 65, in init
tf.lite.experimental.load_delegate(self.EDGETPU_SHARED_LIB)
File "/home/pi/.venv/lib/python3.7/site-packages/tensorflow/lite/python/interpreter.py", line 161, in load_delegate
delegate = Delegate(library, options)
File "/home/pi/.venv/lib/python3.7/site-packages/tensorflow/lite/python/interpreter.py", line 90, in init
self._library = ctypes.pydll.LoadLibrary(library)
File "/usr/lib/python3.7/ctypes/init.py", line 434, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.7/ctypes/init.py", line 356, in init
self._handle = _dlopen(self._name, mode)
OSError: libedgetpu.so.1: cannot open shared object file: No such file or directory
Exception ignored in: <function Delegate.del at 0xa5eb8fa8>
Traceback (most recent call last):
File "/home/pi/.venv/lib/python3.7/site-packages/tensorflow/lite/python/interpreter.py", line 125, in del
if self._library is not None:
AttributeError: 'Delegate' object has no attribute '_library'
(.venv) pi@raspberrypi:~ $

Thanks in advance. I really appreciate your help with this issue...

@GBW48
Copy link
Author

GBW48 commented Jun 29, 2020 via email

@GBW48
Copy link
Author

GBW48 commented Jul 4, 2020

Hi Leigh, I reran your instructions for the install/reinstall of Coral's libedgetpu. This time there no errors. After a reboot, I was able to successfully use the Coral accelerator to display and track both objects and faces. Every thing worked!

Thanks so much for creating such an excellent, well conceived and documented project! What a wonderful way to learn about the capabilities of TensorFlow!
...Gary White

P.S.
I'm not sure why the second attempt to apply your fix worked, while the first attempt failed. I'm including the console log for the second install. Perhaps, you might be able to figure out the reason for the failure, if you look at the June 25, 2020 console log associated with the fist installation of the fix.

(.venv) pi@raspberrypi:~ $ echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list

deb https://packages.cloud.google.com/apt coral-edgetpu-stable main

(.venv) pi@raspberrypi:~ $ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 653 100 653 0 0 4766 0 --:--:-- --:--:-- --:--:-- 4766
OK

(.venv) pi@raspberrypi:~ $ sudo apt-get update

Get:1 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Get:3 https://packages.cloud.google.com/apt coral-edgetpu-stable InRelease [6,332 B]
Get:4 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
Get:5 http://archive.raspberrypi.org/debian buster/main armhf Packages [330 kB]
Get:6 https://packages.cloud.google.com/apt coral-edgetpu-stable/main armhf Packages [1,172 B]
Fetched 13.4 MB in 7s (2,019 kB/s)
Reading package lists... Done

(.venv) pi@raspberrypi:~ $ sudo apt-get install libedgetpu1-std

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
rpi-eeprom-images
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
libedgetpu1-std
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
Need to get 274 kB of archives.
After this operation, 624 kB of additional disk space will be used.
Get:1 https://packages.cloud.google.com/apt coral-edgetpu-stable/main armhf libedgetpu1-std armhf 14.0 [274 kB]
Fetched 274 kB in 0s (642 kB/s)
Selecting previously unselected package libedgetpu1-std:armhf.
(Reading database ... 96755 files and directories currently installed.)
Preparing to unpack .../libedgetpu1-std_14.0_armhf.deb ...
Unpacking libedgetpu1-std:armhf (14.0) ...
Setting up libedgetpu1-std:armhf (14.0) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...

I then re-installed Coral's tflite_runtime which also worked. Here are the results:
(.venv) pi@raspberrypi:~ $ pip install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-linux_armv7l.whl

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: tflite-runtime==2.1.0.post1 from https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-linux_armv7l.whl in ./.venv/lib/python3.7/site-packages (2.1.0.post1)
Requirement already satisfied: numpy>=1.12.1 in ./.venv/lib/python3.7/site-packages (from tflite-runtime==2.1.0.post1) (1.19.0)

@GBW48 GBW48 closed this as completed Jul 4, 2020
@GBW48 GBW48 reopened this Jul 4, 2020
@GBW48
Copy link
Author

GBW48 commented Jul 4, 2020

Sorry, I closed this issue by mistake.

@leigh-johnson
Copy link
Member

@GBW48 Woooo, glad that worked for you Gary! Thanks for including logs of your second go. At a glance, I'm not sure what's different. 🤔

I'll prioritize getting installation a bit better scripted/automated. Right now, there are a lot of manual steps that make it tedious to reproduce a working environment. I've been getting by with some Ansible playbooks for my own release testing, but they're too crufty and personal to release for general use.

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

2 participants