diff options
Diffstat (limited to 'source')
23 files changed, 141 insertions, 134 deletions
diff --git a/source/application/api/use_case/ad/include/AdModel.hpp b/source/application/api/use_case/ad/include/AdModel.hpp index 0436a89..d9f8a08 100644 --- a/source/application/api/use_case/ad/include/AdModel.hpp +++ b/source/application/api/use_case/ad/include/AdModel.hpp @@ -19,13 +19,14 @@ #include "Model.hpp" -extern const int g_FrameLength; -extern const int g_FrameStride; -extern const float g_ScoreThreshold; -extern const float g_TrainingMean; - namespace arm { namespace app { + namespace ad { + extern const int g_FrameLength; + extern const int g_FrameStride; + extern const float g_ScoreThreshold; + extern const float g_TrainingMean; + } /* namespace ad */ class AdModel : public Model { diff --git a/source/application/api/use_case/kws/include/MicroNetKwsModel.hpp b/source/application/api/use_case/kws/include/MicroNetKwsModel.hpp index 3d2f3de..e68cd6d 100644 --- a/source/application/api/use_case/kws/include/MicroNetKwsModel.hpp +++ b/source/application/api/use_case/kws/include/MicroNetKwsModel.hpp @@ -28,11 +28,6 @@ namespace kws { extern const uint32_t g_NumMfcc; extern const uint32_t g_NumAudioWins; } /* namespace kws */ -} /* namespace app */ -} /* namespace arm */ - -namespace arm { -namespace app { class MicroNetKwsModel : public Model { public: diff --git a/source/application/api/use_case/noise_reduction/include/RNNoiseModel.hpp b/source/application/api/use_case/noise_reduction/include/RNNoiseModel.hpp index 3d2f23c..0cc0809 100644 --- a/source/application/api/use_case/noise_reduction/include/RNNoiseModel.hpp +++ b/source/application/api/use_case/noise_reduction/include/RNNoiseModel.hpp @@ -19,12 +19,13 @@ #include "Model.hpp" -extern const uint32_t g_NumInputFeatures; -extern const uint32_t g_FrameLength; -extern const uint32_t g_FrameStride; - namespace arm { namespace app { + namespace rnn { + extern const uint32_t g_NumInputFeatures; + extern const uint32_t g_FrameLength; + extern const uint32_t g_FrameStride; + } /* namespace rnn */ class RNNoiseModel : public Model { public: diff --git a/source/application/api/use_case/object_detection/include/DetectorPostProcessing.hpp b/source/application/api/use_case/object_detection/include/DetectorPostProcessing.hpp index 30bc123..6a53688 100644 --- a/source/application/api/use_case/object_detection/include/DetectorPostProcessing.hpp +++ b/source/application/api/use_case/object_detection/include/DetectorPostProcessing.hpp @@ -26,7 +26,6 @@ namespace arm { namespace app { - namespace object_detection { struct Branch { diff --git a/source/application/api/use_case/object_detection/include/YoloFastestModel.hpp b/source/application/api/use_case/object_detection/include/YoloFastestModel.hpp index 4c64433..16d0715 100644 --- a/source/application/api/use_case/object_detection/include/YoloFastestModel.hpp +++ b/source/application/api/use_case/object_detection/include/YoloFastestModel.hpp @@ -19,13 +19,16 @@ #include "Model.hpp" -extern const int originalImageSize; -extern const int channelsImageDisplayed; -extern const float anchor1[]; -extern const float anchor2[]; - namespace arm { namespace app { + namespace object_detection { + extern const int originalImageSize; + extern const int channelsImageDisplayed; + /* NOTE: anchors are different for any given input model size, estimated during training + * phase */ + extern const float anchor1[]; + extern const float anchor2[]; + } /* namespace object_detection */ class YoloFastestModel : public Model { diff --git a/source/application/api/use_case/object_detection/src/DetectorPostProcessing.cc b/source/application/api/use_case/object_detection/src/DetectorPostProcessing.cc index fb1606a..7610c4f 100644 --- a/source/application/api/use_case/object_detection/src/DetectorPostProcessing.cc +++ b/source/application/api/use_case/object_detection/src/DetectorPostProcessing.cc @@ -43,45 +43,42 @@ namespace app { m_topN(topN) { /* Init PostProcessing */ - this->m_net = - object_detection::Network { - .inputWidth = inputImgCols, + this->m_net = object_detection::Network{ + .inputWidth = inputImgCols, .inputHeight = inputImgRows, - .numClasses = numClasses, - .branches = { - object_detection::Branch { - .resolution = inputImgCols/32, - .numBox = 3, - .anchor = anchor1, - .modelOutput = this->m_outputTensor0->data.int8, - .scale = (static_cast<TfLiteAffineQuantization*>( - this->m_outputTensor0->quantization.params))->scale->data[0], - .zeroPoint = (static_cast<TfLiteAffineQuantization*>( - this->m_outputTensor0->quantization.params))->zero_point->data[0], - .size = this->m_outputTensor0->bytes - }, - object_detection::Branch { - .resolution = inputImgCols/16, - .numBox = 3, - .anchor = anchor2, - .modelOutput = this->m_outputTensor1->data.int8, - .scale = (static_cast<TfLiteAffineQuantization*>( - this->m_outputTensor1->quantization.params))->scale->data[0], - .zeroPoint = (static_cast<TfLiteAffineQuantization*>( - this->m_outputTensor1->quantization.params))->zero_point->data[0], - .size = this->m_outputTensor1->bytes - } - }, - .topN = m_topN - }; + .numClasses = numClasses, + .branches = + {object_detection::Branch{.resolution = inputImgCols / 32, + .numBox = 3, + .anchor = arm::app::object_detection::anchor1, + .modelOutput = this->m_outputTensor0->data.int8, + .scale = (static_cast<TfLiteAffineQuantization*>( + this->m_outputTensor0->quantization.params)) + ->scale->data[0], + .zeroPoint = (static_cast<TfLiteAffineQuantization*>( + this->m_outputTensor0->quantization.params)) + ->zero_point->data[0], + .size = this->m_outputTensor0->bytes}, + object_detection::Branch{.resolution = inputImgCols / 16, + .numBox = 3, + .anchor = arm::app::object_detection::anchor2, + .modelOutput = this->m_outputTensor1->data.int8, + .scale = (static_cast<TfLiteAffineQuantization*>( + this->m_outputTensor1->quantization.params)) + ->scale->data[0], + .zeroPoint = (static_cast<TfLiteAffineQuantization*>( + this->m_outputTensor1->quantization.params)) + ->zero_point->data[0], + .size = this->m_outputTensor1->bytes}}, + .topN = m_topN}; /* End init */ } bool DetectorPostProcess::DoPostProcess() { /* Start postprocessing */ - int originalImageWidth = originalImageSize; - int originalImageHeight = originalImageSize; + int originalImageWidth = arm::app::object_detection::originalImageSize; + int originalImageHeight = arm::app::object_detection::originalImageSize; std::forward_list<image::Detection> detections; GetNetworkBoxes(this->m_net, originalImageWidth, originalImageHeight, m_threshold, detections); diff --git a/source/hal/source/platform/mps3/CMakeLists.txt b/source/hal/source/platform/mps3/CMakeLists.txt index 46da2fa..332837c 100644 --- a/source/hal/source/platform/mps3/CMakeLists.txt +++ b/source/hal/source/platform/mps3/CMakeLists.txt @@ -25,7 +25,7 @@ project(${PLATFORM_DRIVERS_TARGET} DESCRIPTION "Platform drivers library for MPS3 FPGA/FVP targets" LANGUAGES C CXX ASM) -# 1. We should be cross-compiling (MPS3 taregt only runs Cortex-M targets) +# 1. We should be cross-compiling (MPS3 target only runs Cortex-M targets) if (NOT ${CMAKE_CROSSCOMPILING}) message(FATAL_ERROR "No ${PLATFORM_DRIVERS_TARGET} support for this target.") endif() diff --git a/source/use_case/ad/src/MainLoop.cc b/source/use_case/ad/src/MainLoop.cc index c9d763c..4e5edc1 100644 --- a/source/use_case/ad/src/MainLoop.cc +++ b/source/use_case/ad/src/MainLoop.cc @@ -22,14 +22,15 @@ #include "BufAttributes.hpp" /* Buffer attributes to be applied */ namespace arm { - namespace app { - static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; - } /* namespace app */ +namespace app { + namespace ad { + extern uint8_t* GetModelPointer(); + extern size_t GetModelLen(); + } /* namespace ad */ + static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; +} /* namespace app */ } /* namespace arm */ -extern uint8_t* GetModelPointer(); -extern size_t GetModelLen(); - enum opcodes { MENU_OPT_RUN_INF_NEXT = 1, /* Run on next vector */ @@ -53,7 +54,6 @@ static void DisplayMenu() fflush(stdout); } - void main_loop() { arm::app::AdModel model; /* Model wrapper object. */ @@ -61,9 +61,8 @@ void main_loop() /* Load the model. */ if (!model.Init(arm::app::tensorArena, sizeof(arm::app::tensorArena), - GetModelPointer(), - GetModelLen())) - { + arm::app::ad::GetModelPointer(), + arm::app::ad::GetModelLen())) { printf_err("failed to initialise model\n"); return; } @@ -75,10 +74,10 @@ void main_loop() caseContext.Set<arm::app::Profiler&>("profiler", profiler); caseContext.Set<arm::app::Model&>("model", model); caseContext.Set<uint32_t>("clipIndex", 0); - caseContext.Set<uint32_t>("frameLength", g_FrameLength); - caseContext.Set<uint32_t>("frameStride", g_FrameStride); - caseContext.Set<float>("scoreThreshold", g_ScoreThreshold); - caseContext.Set<float>("trainingMean", g_TrainingMean); + caseContext.Set<uint32_t>("frameLength", arm::app::ad::g_FrameLength); + caseContext.Set<uint32_t>("frameStride", arm::app::ad::g_FrameStride); + caseContext.Set<float>("scoreThreshold", arm::app::ad::g_ScoreThreshold); + caseContext.Set<float>("trainingMean", arm::app::ad::g_TrainingMean); /* Main program loop. */ bool executionSuccessful = true; diff --git a/source/use_case/ad/usecase.cmake b/source/use_case/ad/usecase.cmake index 06d7681..d19820d 100644 --- a/source/use_case/ad/usecase.cmake +++ b/source/use_case/ad/usecase.cmake @@ -86,4 +86,4 @@ generate_tflite_code( MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH} DESTINATION ${SRC_GEN_DIR} EXPRESSIONS ${EXTRA_MODEL_CODE} -) + NAMESPACE "arm" "app" "ad") diff --git a/source/use_case/asr/src/MainLoop.cc b/source/use_case/asr/src/MainLoop.cc index 354d1f7..290c41c 100644 --- a/source/use_case/asr/src/MainLoop.cc +++ b/source/use_case/asr/src/MainLoop.cc @@ -25,11 +25,11 @@ namespace arm { namespace app { -namespace asr { static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; - extern uint8_t* GetModelPointer(); - extern size_t GetModelLen(); -} /* namespace asr */ + namespace asr { + extern uint8_t* GetModelPointer(); + extern size_t GetModelLen(); + } /* namespace asr */ } /* namespace app */ } /* namespace arm */ @@ -64,8 +64,8 @@ void main_loop() arm::app::Wav2LetterModel model; /* Model wrapper object. */ /* Load the model. */ - if (!model.Init(arm::app::asr::tensorArena, - sizeof(arm::app::asr::tensorArena), + if (!model.Init(arm::app::tensorArena, + sizeof(arm::app::tensorArena), arm::app::asr::GetModelPointer(), arm::app::asr::GetModelLen())) { printf_err("Failed to initialise model\n"); diff --git a/source/use_case/img_class/src/MainLoop.cc b/source/use_case/img_class/src/MainLoop.cc index 86ea2ea..a44a401 100644 --- a/source/use_case/img_class/src/MainLoop.cc +++ b/source/use_case/img_class/src/MainLoop.cc @@ -24,14 +24,15 @@ #include "BufAttributes.hpp" /* Buffer attributes to be applied */ namespace arm { - namespace app { - static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; - } /* namespace app */ +namespace app { + static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; + namespace img_class { + extern uint8_t* GetModelPointer(); + extern size_t GetModelLen(); + } /* namespace img_class */ +} /* namespace app */ } /* namespace arm */ -extern uint8_t* GetModelPointer(); -extern size_t GetModelLen(); - using ImgClassClassifier = arm::app::Classifier; void main_loop() @@ -41,8 +42,8 @@ void main_loop() /* Load the model. */ if (!model.Init(arm::app::tensorArena, sizeof(arm::app::tensorArena), - GetModelPointer(), - GetModelLen())) { + arm::app::img_class::GetModelPointer(), + arm::app::img_class::GetModelLen())) { printf_err("Failed to initialise model\n"); return; } diff --git a/source/use_case/img_class/usecase.cmake b/source/use_case/img_class/usecase.cmake index 2a8be09..e0b6bc8 100644 --- a/source/use_case/img_class/usecase.cmake +++ b/source/use_case/img_class/usecase.cmake @@ -63,4 +63,4 @@ USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the eval generate_tflite_code( MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH} DESTINATION ${SRC_GEN_DIR} - ) + NAMESPACE "arm" "app" "img_class") diff --git a/source/use_case/inference_runner/src/MainLoop.cc b/source/use_case/inference_runner/src/MainLoop.cc index 28b5c0a..59afa63 100644 --- a/source/use_case/inference_runner/src/MainLoop.cc +++ b/source/use_case/inference_runner/src/MainLoop.cc @@ -22,17 +22,15 @@ #include "BufAttributes.hpp" /* Buffer attributes to be applied */ namespace arm { - namespace app { - static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; - } /* namespace app */ -} /* namespace arm */ - +namespace app { + static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; + namespace inference_runner { #if defined(DYNAMIC_MODEL_BASE) && defined(DYNAMIC_MODEL_SIZE) static uint8_t* GetModelPointer() { info("Model pointer: 0x%08x\n", DYNAMIC_MODEL_BASE); - return reinterpret_cast<uint8_t *>(DYNAMIC_MODEL_BASE); + return reinterpret_cast<uint8_t*>(DYNAMIC_MODEL_BASE); } static size_t GetModelLen() @@ -49,6 +47,9 @@ extern uint8_t* GetModelPointer(); extern size_t GetModelLen(); #endif /* defined(DYNAMIC_MODEL_BASE) && defined(DYNAMIC_MODEL_SIZE) */ + } /* namespace inference_runner */ +} /* namespace app */ +} /* namespace arm */ enum opcodes { @@ -63,8 +64,8 @@ void main_loop() /* Load the model. */ if (!model.Init(arm::app::tensorArena, sizeof(arm::app::tensorArena), - GetModelPointer(), - GetModelLen())) { + arm::app::inference_runner::GetModelPointer(), + arm::app::inference_runner::GetModelLen())) { printf_err("Failed to initialise model\n"); return; } diff --git a/source/use_case/inference_runner/usecase.cmake b/source/use_case/inference_runner/usecase.cmake index c70be71..5a86aa6 100644 --- a/source/use_case/inference_runner/usecase.cmake +++ b/source/use_case/inference_runner/usecase.cmake @@ -72,5 +72,5 @@ else() generate_tflite_code( MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH} DESTINATION ${SRC_GEN_DIR} - ) + NAMESPACE "arm" "app" "inference_runner") endif() diff --git a/source/use_case/kws/src/MainLoop.cc b/source/use_case/kws/src/MainLoop.cc index 550e7a1..e0518f2 100644 --- a/source/use_case/kws/src/MainLoop.cc +++ b/source/use_case/kws/src/MainLoop.cc @@ -26,11 +26,11 @@ namespace arm { namespace app { -namespace kws { static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; - extern uint8_t *GetModelPointer(); - extern size_t GetModelLen(); -} /* namespace kws */ + namespace kws { + extern uint8_t* GetModelPointer(); + extern size_t GetModelLen(); + } /* namespace kws */ } /* namespace app */ } /* namespace arm */ @@ -64,8 +64,8 @@ void main_loop() arm::app::MicroNetKwsModel model; /* Model wrapper object. */ /* Load the model. */ - if (!model.Init(arm::app::kws::tensorArena, - sizeof(arm::app::kws::tensorArena), + if (!model.Init(arm::app::tensorArena, + sizeof(arm::app::tensorArena), arm::app::kws::GetModelPointer(), arm::app::kws::GetModelLen())) { printf_err("Failed to initialise model\n"); diff --git a/source/use_case/kws_asr/src/MainLoop.cc b/source/use_case/kws_asr/src/MainLoop.cc index bba4480..0638ecd 100644 --- a/source/use_case/kws_asr/src/MainLoop.cc +++ b/source/use_case/kws_asr/src/MainLoop.cc @@ -28,17 +28,17 @@ namespace arm { namespace app { - static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; namespace asr { extern uint8_t* GetModelPointer(); extern size_t GetModelLen(); - } + } /* namespace asr */ namespace kws { extern uint8_t* GetModelPointer(); extern size_t GetModelLen(); - } + } /* namespace kws */ + static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; } /* namespace app */ } /* namespace arm */ diff --git a/source/use_case/noise_reduction/src/MainLoop.cc b/source/use_case/noise_reduction/src/MainLoop.cc index 257f5cf..bc277da 100644 --- a/source/use_case/noise_reduction/src/MainLoop.cc +++ b/source/use_case/noise_reduction/src/MainLoop.cc @@ -22,14 +22,15 @@ #include "BufAttributes.hpp" /* Buffer attributes to be applied */ namespace arm { - namespace app { - static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; - } /* namespace app */ +namespace app { + static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; + namespace rnn { + extern uint8_t* GetModelPointer(); + extern size_t GetModelLen(); + } /* namespace rnn */ +} /* namespace app */ } /* namespace arm */ -extern uint8_t* GetModelPointer(); -extern size_t GetModelLen(); - enum opcodes { MENU_OPT_RUN_INF_NEXT = 1, /* Run on next vector. */ @@ -74,8 +75,8 @@ void main_loop() /* Load the model. */ if (!model.Init(arm::app::tensorArena, sizeof(arm::app::tensorArena), - GetModelPointer(), - GetModelLen())) { + arm::app::rnn::GetModelPointer(), + arm::app::rnn::GetModelLen())) { printf_err("Failed to initialise model\n"); return; } @@ -85,9 +86,9 @@ void main_loop() arm::app::Profiler profiler{"noise_reduction"}; caseContext.Set<arm::app::Profiler&>("profiler", profiler); - caseContext.Set<uint32_t>("numInputFeatures", g_NumInputFeatures); - caseContext.Set<uint32_t>("frameLength", g_FrameLength); - caseContext.Set<uint32_t>("frameStride", g_FrameStride); + caseContext.Set<uint32_t>("numInputFeatures", arm::app::rnn::g_NumInputFeatures); + caseContext.Set<uint32_t>("frameLength", arm::app::rnn::g_FrameLength); + caseContext.Set<uint32_t>("frameStride", arm::app::rnn::g_FrameStride); caseContext.Set<arm::app::RNNoiseModel&>("model", model); SetAppCtxClipIdx(caseContext, 0); diff --git a/source/use_case/noise_reduction/usecase.cmake b/source/use_case/noise_reduction/usecase.cmake index 0cd0761..199f8e1 100644 --- a/source/use_case/noise_reduction/usecase.cmake +++ b/source/use_case/noise_reduction/usecase.cmake @@ -81,7 +81,7 @@ generate_tflite_code( MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH} DESTINATION ${SRC_GEN_DIR} EXPRESSIONS ${EXTRA_MODEL_CODE} -) + NAMESPACE "arm" "app" "rnn") # For MPS3, allow dumping of output data to memory, based on these parameters: diff --git a/source/use_case/object_detection/src/MainLoop.cc b/source/use_case/object_detection/src/MainLoop.cc index 4d70d2d..dc9b693 100644 --- a/source/use_case/object_detection/src/MainLoop.cc +++ b/source/use_case/object_detection/src/MainLoop.cc @@ -23,14 +23,15 @@ #include "BufAttributes.hpp" /* Buffer attributes to be applied */ namespace arm { - namespace app { - static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; - } /* namespace app */ +namespace app { + static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; + namespace object_detection { + extern uint8_t* GetModelPointer(); + extern size_t GetModelLen(); + } /* namespace object_detection */ +} /* namespace app */ } /* namespace arm */ -extern uint8_t* GetModelPointer(); -extern size_t GetModelLen(); - static void DisplayDetectionMenu() { printf("\n\n"); @@ -52,8 +53,8 @@ void main_loop() /* Load the model. */ if (!model.Init(arm::app::tensorArena, sizeof(arm::app::tensorArena), - GetModelPointer(), - GetModelLen())) { + arm::app::object_detection::GetModelPointer(), + arm::app::object_detection::GetModelLen())) { printf_err("Failed to initialise model\n"); return; } diff --git a/source/use_case/object_detection/src/UseCaseHandler.cc b/source/use_case/object_detection/src/UseCaseHandler.cc index 4d0877a..e9bcd4a 100644 --- a/source/use_case/object_detection/src/UseCaseHandler.cc +++ b/source/use_case/object_detection/src/UseCaseHandler.cc @@ -27,6 +27,9 @@ namespace arm { namespace app { + namespace object_detection { + extern const int channelsImageDisplayed; + } /* namespace object_detection */ /** * @brief Presents inference results along using the data presentation @@ -122,9 +125,13 @@ namespace app { /* Display image on the LCD. */ hal_lcd_display_image( - (channelsImageDisplayed == 3) ? currImage : dstPtr, - inputImgCols, inputImgRows, channelsImageDisplayed, - dataPsnImgStartX, dataPsnImgStartY, dataPsnImgDownscaleFactor); + (arm::app::object_detection::channelsImageDisplayed == 3) ? currImage : dstPtr, + inputImgCols, + inputImgRows, + arm::app::object_detection::channelsImageDisplayed, + dataPsnImgStartX, + dataPsnImgStartY, + dataPsnImgDownscaleFactor); /* Display message on the LCD - inference running. */ hal_lcd_display_text(str_inf.c_str(), str_inf.size(), diff --git a/source/use_case/object_detection/usecase.cmake b/source/use_case/object_detection/usecase.cmake index 850e7fc..b0a07d5 100644 --- a/source/use_case/object_detection/usecase.cmake +++ b/source/use_case/object_detection/usecase.cmake @@ -76,4 +76,4 @@ generate_tflite_code( MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH} DESTINATION ${SRC_GEN_DIR} EXPRESSIONS ${EXTRA_MODEL_CODE} - ) + NAMESPACE "arm" "app" "object_detection") diff --git a/source/use_case/vww/src/MainLoop.cc b/source/use_case/vww/src/MainLoop.cc index fae7530..4fb5df7 100644 --- a/source/use_case/vww/src/MainLoop.cc +++ b/source/use_case/vww/src/MainLoop.cc @@ -25,14 +25,15 @@ #include "BufAttributes.hpp" /* Buffer attributes to be applied */ namespace arm { - namespace app { - static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; - } /* namespace app */ +namespace app { + static uint8_t tensorArena[ACTIVATION_BUF_SZ] ACTIVATION_BUF_ATTRIBUTE; + namespace vww { + extern uint8_t* GetModelPointer(); + extern size_t GetModelLen(); + } /* namespace vww */ +} /* namespace app */ } /* namespace arm */ -extern uint8_t* GetModelPointer(); -extern size_t GetModelLen(); - using ViusalWakeWordClassifier = arm::app::Classifier; void main_loop() @@ -42,8 +43,8 @@ void main_loop() /* Load the model. */ if (!model.Init(arm::app::tensorArena, sizeof(arm::app::tensorArena), - GetModelPointer(), - GetModelLen())) { + arm::app::vww::GetModelPointer(), + arm::app::vww::GetModelLen())) { printf_err("Failed to initialise model\n"); return; } diff --git a/source/use_case/vww/usecase.cmake b/source/use_case/vww/usecase.cmake index f6a3efe..7ef4596 100644 --- a/source/use_case/vww/usecase.cmake +++ b/source/use_case/vww/usecase.cmake @@ -48,7 +48,7 @@ USER_OPTION(${use_case}_MODEL_TFLITE_PATH "NN models file to be used in the eval generate_tflite_code( MODEL_PATH ${${use_case}_MODEL_TFLITE_PATH} DESTINATION ${SRC_GEN_DIR} -) + NAMESPACE "arm" "app" "vww") # Generate labels file set(${use_case}_LABELS_CPP_FILE Labels) |