mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-09 13:06:54 +03:00
Update Rolling
DELETE ALL Restructure CTfLiteAll
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __CFINDTEMPLATE
|
||||
#define __CFINGTEMPLATE
|
||||
|
||||
#define TFLITE_MINIMAL_CHECK(x) \
|
||||
if (!(x)) { \
|
||||
@@ -9,9 +5,6 @@
|
||||
exit(1); \
|
||||
}
|
||||
|
||||
//#include "CAccessSD.h"
|
||||
#include "CFindTemplate.h"
|
||||
|
||||
#include "tensorflow/lite/micro/kernels/all_ops_resolver.h"
|
||||
#include "tensorflow/lite/micro/micro_error_reporter.h"
|
||||
#include "tensorflow/lite/micro/micro_interpreter.h"
|
||||
@@ -21,37 +14,44 @@
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
//extern CAccessSDClass accessSD;
|
||||
|
||||
|
||||
#define SUPRESS_TFLITE_ERRORS // use, to avoid error messages from TFLITE
|
||||
|
||||
#ifdef SUPRESS_TFLITE_ERRORS
|
||||
#include "tensorflow/lite/core/api/error_reporter.h"
|
||||
#include "tensorflow/lite/micro/compatibility.h"
|
||||
#include "tensorflow/lite/micro/debug_log.h"
|
||||
///// OwnErrorReporter to prevent printing of Errors (especially unavoidable in CalculateActivationRangeQuantized@kerne_util.cc)
|
||||
namespace tflite {
|
||||
class OwnMicroErrorReporter : public ErrorReporter {
|
||||
public:
|
||||
int Report(const char* format, va_list args) override;
|
||||
};
|
||||
} // namespace tflite
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif
|
||||
|
||||
class CTfLiteClass
|
||||
{
|
||||
protected:
|
||||
// CAccessSDClass *accessSD;
|
||||
|
||||
tflite::ErrorReporter* error_reporter;
|
||||
|
||||
tflite::ErrorReporter *error_reporter;
|
||||
const tflite::Model* model;
|
||||
tflite::MicroInterpreter* interpreter;
|
||||
// TfLiteTensor* input = nullptr;
|
||||
TfLiteTensor* output = nullptr;
|
||||
static tflite::ops::micro::AllOpsResolver *resolver;
|
||||
|
||||
tflite::MicroOpResolver<5> micro_op_resolver;
|
||||
|
||||
|
||||
int kTensorArenaSize;
|
||||
uint8_t *tensor_arena;
|
||||
|
||||
float* input;
|
||||
int input_i;
|
||||
|
||||
int im_height, im_width, im_channel;
|
||||
|
||||
long GetFileSize(std::string filename);
|
||||
unsigned char* ReadFileToCharArray(std::string _fn);
|
||||
|
||||
public:
|
||||
// CTfLiteClass(CAccessSDClass *_accessSD);
|
||||
CTfLiteClass();
|
||||
~CTfLiteClass();
|
||||
void LoadModel(std::string _fn);
|
||||
@@ -65,8 +65,5 @@ class CTfLiteClass
|
||||
|
||||
float GetOutputValue(int nr);
|
||||
void GetInputDimension(bool silent);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user