Arduino TensorflowLite examples not compiling

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
biomakerstef
 
Posts: 2
Joined: Sat Jan 15, 2022 11:17 pm

Arduino TensorflowLite examples not compiling

Post by biomakerstef »

Hi there,
I have an Adafruit EdgeBadge, and was trying to go through some of the example tutorials. I've installed the boards + the Tensorflow Lite libraries (2.4.0), but I'm getting an error compiling the example sketches (hello world and magic wand).

Code: Select all

Arduino: 1.8.19 (Mac OS X), Board: "Adafruit pyBadge M4 Express (SAMD51), Enabled, 180 MHz (overclock), Fastest (-Ofast), 50 MHz (standard), TinyUSB, Off"

Library Arduino_TensorFlowLite has been declared precompiled:
Precompiled library in "./Documents/Arduino/libraries/Arduino_TensorFlowLite/src/cortex-m4/fpv4-sp-d16-hard" not found
Precompiled library in "./Documents/Arduino/libraries/Arduino_TensorFlowLite/src/cortex-m4" not found
./Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/tools/make/downloads/kissfft/kiss_fft.c: In function 'kiss_fft_stride':
./Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/tools/make/downloads/kissfft/kiss_fft.c:378:9: warning: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
  378 |         memcpy(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft);
      |         ^~~~~~
./Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/tools/make/downloads/kissfft/kiss_fft.c:378:9: warning: incompatible implicit declaration of built-in function 'memcpy'
./Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/tools/make/downloads/kissfft/kiss_fft.c:17:1: note: include '<string.h>' or provide a declaration of 'memcpy'
   16 | #include "third_party/kissfft/_kiss_fft_guts.h"
  +++ |+#include <string.h>
   17 | /* The guts header contains all the multiplication and addition macros that are defined for
./Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/magic_wand.ino.cpp.o: in function `setup':
./Documents/Arduino/libraries/Arduino_TensorFlowLite/examples/magic_wand/magic_wand.ino:104: undefined reference to `SetupAccelerometer(tflite::ErrorReporter*)'
./Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/magic_wand.ino.cpp.o: in function `loop':
./Documents/Arduino/libraries/Arduino_TensorFlowLite/examples/magic_wand/magic_wand.ino:113: undefined reference to `ReadAccelerometer(tflite::ErrorReporter*, float*, int)'
./Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: ./Documents/Arduino/libraries/Arduino_TensorFlowLite/examples/magic_wand/magic_wand.ino:120: undefined reference to `begin_index'
./Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: ./Documents/Arduino/libraries/Arduino_TensorFlowLite/examples/magic_wand/magic_wand.ino:128: undefined reference to `HandleOutput(tflite::ErrorReporter*, int)'
./Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Arduino_TensorFlowLite/tensorflow/lite/micro/arduino/debug_log.cpp.o: in function `DebugLog':
./Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/arduino/debug_log.cpp:34: undefined reference to `Adafruit_USBD_CDC::begin(unsigned long)'
./Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: ./Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/arduino/debug_log.cpp:37: undefined reference to `Serial'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Adafruit pyBadge M4 Express (SAMD51).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
If I turn on the verbose output, the error seems to occur after it says "Linking everything together"
My IDE is 1.8.19, running on an M1 Mac, running Big Sur.

I've tried switching to earlier versions of the TensorflowLite library, but 1.15 is missing some required .h files for the examples. Using 2.1.0 (all alpha, not pre-compiled) gives the same result as 2.4.0.

Any suggestions/help/insights would be great!
Cheers!

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Arduino TensorflowLite examples not compiling

Post by mikeysklar »

Did you try this specific version 1.15-0.ALPHA (not pre-compiled).
You must use 1.15-0-ALPHA (not-precompiled) - no other version will work!
https://learn.adafruit.com/tensorflow-l ... g-examples

User avatar
biomakerstef
 
Posts: 2
Joined: Sat Jan 15, 2022 11:17 pm

Re: Arduino TensorflowLite examples not compiling

Post by biomakerstef »

I've tried that version. After playing around with it some more, the hello_world_arcada example in the tutorial does work with 1.15 alpha, not with any of the others, so at least I can work off off that one :) However, none of the Tensorflow Lite example sketches in the Arduino IDE (hello_world, magic_wand, micro_speech and person_detection) work with that version or any of the other library versions. With the later versions. I'm getting the undefined reference errors, with 1.15 I get missing library files... I was mainly interested in getting the speech examples to work, so kind of stuck on this one. Are there known problems with later versions of the Tensorflow Lite library?

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Arduino TensorflowLite examples not compiling

Post by mikeysklar »

In terms of the EdgeBadge quickstart guide it explicitly requests the of 1.15-alpha claiming no other versions will work. You can post your errors and we can look into those. It might be helpful to start with a fresh Arduino install directory using only 1.15-alpha to avoid any confusion with previous library installs.

If your interest is in speech examples have you looked at our guide "How to train new TensorFlow Lite micro speech models" it is quite different using Colab and is also EdgeBadge compatible.

https://learn.adafruit.com/how-to-train ... with-colab

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”