| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #pragma once
- #ifndef CTFLITECLASS_H
- #define CTFLITECLASS_H
- #include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
- #include "tensorflow/lite/micro/micro_interpreter.h"
- #include "tensorflow/lite/schema/schema_generated.h"
- #include "esp_err.h"
- #include "esp_log.h"
- #include "CImageBasis.h"
- class CTfLiteClass
- {
- protected:
- tflite::MicroMutableOpResolver<10> resolver;
- const tflite::Model *model;
- tflite::MicroInterpreter *interpreter;
- TfLiteTensor *output = nullptr;
- int kTensorArenaSize;
- uint8_t *tensor_arena;
- unsigned char *modelfile = NULL;
- float *input;
- int input_i;
- int im_height, im_width, im_channel;
- long GetFileSize(std::string filename);
- bool ReadFileToModel(std::string filename);
- bool MakeStaticResolver(void);
- public:
- CTfLiteClass();
- ~CTfLiteClass();
- bool LoadModel(std::string filename);
- bool MakeAllocate(void);
- bool LoadInputImageBasis(CImageBasis *rs);
- void Invoke(void);
- int GetAnzOutPut(bool silent = true);
- int GetOutClassification(int _von = -1, int _bis = -1);
- int GetClassFromImageBasis(CImageBasis *rs);
- float GetOutputValue(int nr);
- void GetInputDimension(bool silent);
- int ReadInputDimenstion(int _dim);
- };
- #endif // CTFLITECLASS_H
|