Namburger / edgetpu-minimal-example

minimal example with native build instructions
Apache License 2.0
24 stars 6 forks source link

Doesn't work on Raspberry Pi CM3+ #4

Open Valdiolus opened 2 years ago

Valdiolus commented 2 years ago

Hi! I am working with the custom board with CM3+ and edgetpu. During compilation of "edgetpu-minimal-example" master all is ok, I see all compiled libraries. But after I can't compile my code with edgetpu libraries (on C). It fails with the followong error:

/usr/bin/ld: /home/pi/edgetpu-minimal-example/build/tensorflow/src/tf/tensorflow/lite/tools/make/gen/rpi_armv7l/lib/libtensorflow-lite.a(densify.o): in function tflite::ops::builtin::densify::Eval(TfLiteContext*, TfLiteNode*)': densify.cc:(.text+0x388): undefined reference totflite::optimize::sparsity::FormatConverter::FormatConverter(std::vector<int, std::allocator > const&, TfLiteSparsity const&)' /usr/bin/ld: densify.cc:(.text+0x394): undefined reference to tflite::optimize::sparsity::FormatConverter<signed char>::SparseToDense(signed char const*)' /usr/bin/ld: densify.cc:(.text+0x730): undefined reference totflite::optimize::sparsity::FormatConverter::FormatConverter(std::vector<int, std::allocator > const&, TfLiteSparsity const&)' /usr/bin/ld: densify.cc:(.text+0x73c): undefined reference to tflite::optimize::sparsity::FormatConverter<float>::SparseToDense(float const*)' /usr/bin/ld: /home/pi/edgetpu-minimal-example/build/tensorflow/src/tf/tensorflow/lite/tools/make/gen/rpi_armv7l/lib/libtensorflow-lite.a(spectrogram.o): in functiontflite::internal::Spectrogram::ProcessCoreFFT()': spectrogram.cc:(.text+0xc0): undefined reference to `rdft' collect2: error: ld returned 1 exit status make: *** [Makefile:32: rwc_main] Error 1

I also tried to launch "minimal" with *_edgetpu.tflite - ended with the following error:

ERROR: Encountered unresolved custom op: edgetpu-custom-op.
ERROR: Node number 0 (edgetpu-custom-op) failed to prepare.

Failed to allocate tensors.
Segmentation fault

I checked the same with Raspberry pi 4 - all works fine. What could be the issue? Also, python edgetpu code works on RPI3+, but I need C libraries running. Thanks!

Valdiolus commented 2 years ago

After a 1 full week of work I found the way to install it on the RPI CM3+. You don't need to install Bazel (I tried - doesn't work well) or some weird tf commit. Just zip compiled /edgetpu-minimal-example from RPI4 and unzip it in the same place (in home) on the RPI3.

Next - you need libedgetpu1-max_14.1_armhf.deb (because 16 version doesn't work) - I found this version in cache on RPI4)))))) dpkg -i libedgetpu1-max_14.1_armhf.deb

That's all!!!