arduino / ArduinoTensorFlowLiteTutorials

260 stars 117 forks source link

no matching function for call to tflite::MicroInterpreter #36

Open minnyqiu opened 1 year ago

minnyqiu commented 1 year ago

In file included from /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/micro_error_reporter.h:19:0, from /Users/ballball/Documents/Arduino/gesture/IMU_Classifier/IMU_Classifier.ino:25: /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/experimental/micro/compatibility.h:29:0: warning: "TF_LITE_REMOVE_VIRTUAL_DELETE" redefined

define TF_LITE_REMOVE_VIRTUAL_DELETE

In file included from /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/all_ops_resolver.h:18:0, from /Users/ballball/Documents/Arduino/gesture/IMU_Classifier/IMU_Classifier.ino:24: /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/compatibility.h:26:0: note: this is the location of the previous definition

define TF_LITE_REMOVE_VIRTUAL_DELETE \

/Users/ballball/Documents/Arduino/gesture/IMU_Classifier/IMU_Classifier.ino: In function 'void setup()': /Users/ballball/Documents/Arduino/gesture/IMU_Classifier/IMU_Classifier.ino:91:122: error: no matching function for call to 'tflite::MicroInterpreter::MicroInterpreter(const tflite::Model&, tflite::AllOpsResolver&, byte [8192], const int&, tflite::MicroErrorReporter)' tflInterpreter = new tflite::MicroInterpreter(tflModel, tflOpsResolver, tensorArena, tensorArenaSize, &tflErrorReporter); ^ In file included from /Users/ballball/Documents/Arduino/gesture/IMU_Classifier/IMU_Classifier.ino:26:0: /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/micro_interpreter.h:60:3: note: candidate: tflite::MicroInterpreter::MicroInterpreter(const tflite::Model, const tflite::MicroOpResolver&, tflite::MicroAllocator, tflite::MicroResourceVariables, tflite::MicroProfilerInterface) MicroInterpreter(const Model model, const MicroOpResolver& op_resolver, ^~~~ /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/micro_interpreter.h:60:3: note: no known conversion for argument 3 from 'byte [8192] {aka unsigned char [8192]}' to 'tflite::MicroAllocator' /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/micro_interpreter.h:50:3: note: candidate: tflite::MicroInterpreter::MicroInterpreter(const tflite::Model, const tflite::MicroOpResolver&, uint8_t, size_t, tflite::MicroResourceVariables, tflite::MicroProfilerInterface) MicroInterpreter(const Model model, const MicroOpResolver& op_resolver, ^~~~ /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/micro_interpreter.h:50:3: note: no known conversion for argument 5 from 'tflite::MicroErrorReporter' to 'tflite::MicroResourceVariables*' /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/micro_interpreter.h:40:7: note: candidate: constexpr tflite::MicroInterpreter::MicroInterpreter(const tflite::MicroInterpreter&) class MicroInterpreter { ^~~~ /Users/ballball/Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/micro_interpreter.h:40:7: note: candidate expects 1 argument, 5 provided /Users/ballball/Documents/Arduino/gesture/IMU_Classifier/IMU_Classifier.ino: In function 'void loop()': /Users/ballball/Documents/Arduino/gesture/IMU_Classifier/IMU_Classifier.ino:152:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < NUM_GESTURES; i++) {

exit status 1

Compilation error: no matching function for call to 'tflite::MicroInterpreter::MicroInterpreter(const tflite::Model&, tflite::AllOpsResolver&, byte [8192], const int&, tflite::MicroErrorReporter)'

palnitin24 commented 8 months ago

The issue you're facing due to "tflite::MicroInterpreter::MicroInterpreter(const tflite::Model&, tflite::AllOpsResolver&, byte [8192], const int&, tflite::MicroErrorReporter)" this line, to resolve it go to "Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/micro/micro_interpreter.h"

And check whether the

MicroInterpreter(const Model* model, const MicroOpResolver& op_resolver,
         uint8_t* tensor_arena, size_t tensor_arena_size,
         MicroResourceVariables* resource_variables = nullptr,
         MicroProfilerInterface* profiler = nullptr);

is like the above lines of code in your file and if yes then go to imu_classifier and replace the line in your imu_classifier with the modified line.

Here is the modified line: tflInterpreter = new tflite::MicroInterpreter(tflModel, tflOpsResolver, tensorArena, tensorArenaSize, nullptr, nullptr);

Adjust the uint 8 with the below code

constexpr int tensorArenaSize = 8 * 1024;
uint8_t tensorArena[tensorArenaSize] __attribute__((aligned(16)));