summaryrefslogtreecommitdiff
path: root/source/application/api/use_case
diff options
context:
space:
mode:
authorLiam Barry <liam.barry@arm.com>2022-05-09 17:06:19 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2022-05-12 16:10:06 +0000
commit213a543dd0d07b2f8d51a9c7e2055fd99291c960 (patch)
tree7357c9961f395131140f8937e732fee68963dc63 /source/application/api/use_case
parentdd44d29775e53ad311e1997bb8a7670d0ee6383e (diff)
downloadml-embedded-evaluation-kit-213a543dd0d07b2f8d51a9c7e2055fd99291c960.tar.gz
MLECO-3186: Each use case should same namespace convention as KWS and ASR
Certain UCs required additional work due to case context variables which also became part of a namespace in generated files. Solution was to declare these extra variables as part of the UC namespace in the respective model.hpp files. Additional changes to standardise use of namespaces may be required - proposing new task. Minor typo and rewording of customizing.md in relevant sections included. Signed-off-by: Liam Barry <liam.barry@arm.com> Change-Id: Ie78f82a30be252cb841136ea5115f21fc8d762cb
Diffstat (limited to 'source/application/api/use_case')
-rw-r--r--source/application/api/use_case/ad/include/AdModel.hpp11
-rw-r--r--source/application/api/use_case/kws/include/MicroNetKwsModel.hpp5
-rw-r--r--source/application/api/use_case/noise_reduction/include/RNNoiseModel.hpp9
-rw-r--r--source/application/api/use_case/object_detection/include/DetectorPostProcessing.hpp1
-rw-r--r--source/application/api/use_case/object_detection/include/YoloFastestModel.hpp13
-rw-r--r--source/application/api/use_case/object_detection/src/DetectorPostProcessing.cc61
6 files changed, 48 insertions, 52 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);