teachablemachine-community icon indicating copy to clipboard operation
teachablemachine-community copied to clipboard

[BUG]: 'capDataLen' was not declared in this scope while Running Exported Model

Open indrayudd opened this issue 3 years ago • 3 comments

Description I followed each and every step given in the embedded teachable machine documentation , but in the last step, where I needed to download the tflite model for embedded systems and compile the sketch, the following error occurred:

_Arduino: 1.8.12 (Windows 10), Board: "Arduino Nano 33 BLE"

sketch\arduino_image_provider.cpp: In function 'TfLiteStatus ProcessImage(tflite::ErrorReporter*, int, int, int8_t*)':

arduino_image_provider.cpp:89:26: error: 'capDataLen' was not declared in this scope_

   if (i2 > 0 && i2 < capDataLen - 1) {

                      ^~~~~~~~~~

arduino_image_provider.cpp:98:26: error: 'capDataLen' was not declared in this scope

   if (i3 > 0 && i3 < capDataLen - 1) {

                      ^~~~~~~~~~

arduino_image_provider.cpp:108:26: error: 'capDataLen' was not declared in this scope

   if (i4 > 0 && i4 < capDataLen - 1) {

                      ^~~~~~~~~~

_exit status 1 'capDataLen' was not declared in this scope

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences._

Expected behavior According to the documentation, it should run: ` Running your model on the Arduino Hit Export model above the preview window in Teachable Machine. Select Tensorflow Lite, then Tensorflow Lite for Microcontrollers and Hit 'Download my Model'. This will convert your model in the background for a few moments, then download a zip folder containing an Arduino sketch with your model loaded.

Close any open Processing Sketches and upload this sketch to your Arduino. When the upload is complete, check the Serial Monitor. You will see the class names printed next to the confidence in each class. `

Screenshots image

Desktop (please complete the following information):

  • OS: Windows 10 Home Single Language
  • Browser: Chrome

indrayudd avatar Oct 05 '21 08:10 indrayudd

I got the same bug, wondering if anyone has found a fix yet?

I am using the same Arduino and Browser but on MacOS 11.3.1

matthewlaujh avatar Oct 26 '21 14:10 matthewlaujh

Hey, did you find a solution for the issue? I am faced the same issue on MacOS 11.6. Thanks!

Chrissiko avatar Dec 17 '21 08:12 Chrissiko

hey guys, It works for me. Just add this code:

const int capDataLen = kCaptureWidth * kCaptureHeight * 2;

by the way, In my case, I put it on the number 49 line. I found the solution here: link

moisesStevend avatar Jan 11 '22 04:01 moisesStevend