Update Rolling

DELETE ALL
Restructure CTfLiteAll
This commit is contained in:
jomjol
2020-09-10 22:03:28 +02:00
parent 186a500a1e
commit 97adcec80e
16 changed files with 976 additions and 546 deletions

View File

@@ -114,6 +114,8 @@ bool CTfLiteClass::LoadInputImage(std::string _fn)
unsigned int h = image.height();
unsigned char red, green, blue;
// printf("Image: %s size: %d x %d\n", _fn.c_str(), w, h);
input_i = 0;
float* input_data_ptr = (interpreter->input(0))->data.f;
@@ -139,24 +141,6 @@ bool CTfLiteClass::LoadInputImage(std::string _fn)
void CTfLiteClass::MakeAllocate()
{
/*
this->micro_op_resolver.AddBuiltin(
tflite::BuiltinOperator_RESHAPE,
tflite::ops::micro::Register_RESHAPE());
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_CONV_2D,
tflite::ops::micro::Register_CONV_2D());
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_FULLY_CONNECTED,
tflite::ops::micro::Register_FULLY_CONNECTED());
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_SOFTMAX,
tflite::ops::micro::Register_SOFTMAX());
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_DEPTHWISE_CONV_2D,
tflite::ops::micro::Register_DEPTHWISE_CONV_2D());
this->interpreter = new tflite::MicroInterpreter(this->model, this->micro_op_resolver, this->tensor_arena, this->kTensorArenaSize, this->error_reporter);
*/
static tflite::ops::micro::AllOpsResolver resolver;
this->interpreter = new tflite::MicroInterpreter(this->model, resolver, this->tensor_arena, this->kTensorArenaSize, this->error_reporter);
@@ -167,7 +151,7 @@ void CTfLiteClass::MakeAllocate()
return;
}
printf("Allocate Done.\n");
// printf("Allocate Done.\n");
}
void CTfLiteClass::GetInputTensorSize(){
@@ -216,8 +200,11 @@ unsigned char* CTfLiteClass::ReadFileToCharArray(std::string _fn)
void CTfLiteClass::LoadModel(std::string _fn){
#ifdef SUPRESS_TFLITE_ERRORS
this->error_reporter = new tflite::OwnMicroErrorReporter;
#else
this->error_reporter = new tflite::MicroErrorReporter;
#endif
unsigned char *rd;
rd = this->ReadFileToCharArray(_fn.c_str());
@@ -226,7 +213,7 @@ void CTfLiteClass::LoadModel(std::string _fn){
this->model = tflite::GetModel(rd);
free(rd);
TFLITE_MINIMAL_CHECK(model != nullptr);
printf("tfile Loaded.\n");
// printf("tfile Loaded.\n");
}
@@ -234,16 +221,12 @@ void CTfLiteClass::LoadModel(std::string _fn){
CTfLiteClass::CTfLiteClass()
{
// this->accessSD = _accessSD;
this->model = nullptr;
this->interpreter = nullptr;
this->input = nullptr;
this->output = nullptr;
this->kTensorArenaSize = 600 * 1024;
this->tensor_arena = new uint8_t[kTensorArenaSize];
// micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_CONV_2D,
// tflite::ops::micro::Register_CONV_2D());
this->tensor_arena = new uint8_t[kTensorArenaSize];
}
CTfLiteClass::~CTfLiteClass()
@@ -252,3 +235,12 @@ CTfLiteClass::~CTfLiteClass()
}
namespace tflite {
int OwnMicroErrorReporter::Report(const char* format, va_list args) {
return 0;
}
} // namespace tflite