summaryrefslogtreecommitdiff
path: root/source/use_case/kws_asr/src
diff options
context:
space:
mode:
authoralexander <alexander.efremov@arm.com>2021-04-29 20:36:09 +0100
committerAlexander Efremov <alexander.efremov@arm.com>2021-05-04 19:57:44 +0000
commitc350cdced0a8a2ca17376f58813e6d48d796ac7c (patch)
treef732cde664837a7cb9429b17e1366bb31a635b15 /source/use_case/kws_asr/src
parent6448932cc1c612d78e62c778ebb228b3cbe96a58 (diff)
downloadml-embedded-evaluation-kit-c350cdced0a8a2ca17376f58813e6d48d796ac7c.tar.gz
MLECO-1868: Code static analyzer warnings fixes
Signed-off-by: alexander <alexander.efremov@arm.com> Change-Id: Ie423e9cad3fabec6ab077ded7236813fe4933dea
Diffstat (limited to 'source/use_case/kws_asr/src')
-rw-r--r--source/use_case/kws_asr/src/AsrClassifier.cc40
-rw-r--r--source/use_case/kws_asr/src/UseCaseHandler.cc120
-rw-r--r--source/use_case/kws_asr/src/Wav2LetterMfcc.cc23
-rw-r--r--source/use_case/kws_asr/src/Wav2LetterPostprocess.cc19
-rw-r--r--source/use_case/kws_asr/src/Wav2LetterPreprocess.cc38
5 files changed, 121 insertions, 119 deletions
diff --git a/source/use_case/kws_asr/src/AsrClassifier.cc b/source/use_case/kws_asr/src/AsrClassifier.cc
index bc86e09..f1fa6f1 100644
--- a/source/use_case/kws_asr/src/AsrClassifier.cc
+++ b/source/use_case/kws_asr/src/AsrClassifier.cc
@@ -21,13 +21,17 @@
#include "Wav2LetterModel.hpp"
template<typename T>
-bool arm::app::AsrClassifier::_GetTopResults(TfLiteTensor* tensor,
- std::vector<ClassificationResult>& vecResults,
- const std::vector <std::string>& labels, double scale, double zeroPoint)
+bool arm::app::AsrClassifier::GetTopResults(TfLiteTensor* tensor,
+ std::vector<ClassificationResult>& vecResults,
+ const std::vector <std::string>& labels, double scale, double zeroPoint)
{
const uint32_t nElems = tensor->dims->data[arm::app::Wav2LetterModel::ms_outputRowsIdx];
const uint32_t nLetters = tensor->dims->data[arm::app::Wav2LetterModel::ms_outputColsIdx];
+ if (nLetters != labels.size()) {
+ printf("Output size doesn't match the labels' size\n");
+ return false;
+ }
/* NOTE: tensor's size verification against labels should be
* checked by the calling/public function. */
@@ -42,7 +46,7 @@ bool arm::app::AsrClassifier::_GetTopResults(TfLiteTensor* tensor,
/* Get the top 1 results. */
for (uint32_t i = 0, row = 0; i < nElems; ++i, row+=nLetters) {
- std::pair<T, uint32_t> top_1 = std::make_pair(tensorData[row + 0], 0);
+ std::pair<T, uint32_t> top_1 = std::make_pair(tensorData[row], 0);
for (uint32_t j = 1; j < nLetters; ++j) {
if (top_1.first < tensorData[row + j]) {
@@ -59,12 +63,12 @@ bool arm::app::AsrClassifier::_GetTopResults(TfLiteTensor* tensor,
return true;
}
-template bool arm::app::AsrClassifier::_GetTopResults<uint8_t>(TfLiteTensor* tensor,
- std::vector<ClassificationResult>& vecResults,
- const std::vector <std::string>& labels, double scale, double zeroPoint);
-template bool arm::app::AsrClassifier::_GetTopResults<int8_t>(TfLiteTensor* tensor,
- std::vector<ClassificationResult>& vecResults,
- const std::vector <std::string>& labels, double scale, double zeroPoint);
+template bool arm::app::AsrClassifier::GetTopResults<uint8_t>(TfLiteTensor* tensor,
+ std::vector<ClassificationResult>& vecResults,
+ const std::vector <std::string>& labels, double scale, double zeroPoint);
+template bool arm::app::AsrClassifier::GetTopResults<int8_t>(TfLiteTensor* tensor,
+ std::vector<ClassificationResult>& vecResults,
+ const std::vector <std::string>& labels, double scale, double zeroPoint);
bool arm::app::AsrClassifier::GetClassificationResults(
TfLiteTensor* outputTensor,
@@ -105,16 +109,16 @@ bool arm::app::AsrClassifier::GetClassificationResults(
switch (outputTensor->type) {
case kTfLiteUInt8:
- resultState = this->_GetTopResults<uint8_t>(
- outputTensor, vecResults,
- labels, quantParams.scale,
- quantParams.offset);
+ resultState = this->GetTopResults<uint8_t>(
+ outputTensor, vecResults,
+ labels, quantParams.scale,
+ quantParams.offset);
break;
case kTfLiteInt8:
- resultState = this->_GetTopResults<int8_t>(
- outputTensor, vecResults,
- labels, quantParams.scale,
- quantParams.offset);
+ resultState = this->GetTopResults<int8_t>(
+ outputTensor, vecResults,
+ labels, quantParams.scale,
+ quantParams.offset);
break;
default:
printf_err("Tensor type %s not supported by classifier\n",
diff --git a/source/use_case/kws_asr/src/UseCaseHandler.cc b/source/use_case/kws_asr/src/UseCaseHandler.cc
index a428210..1edc7c4 100644
--- a/source/use_case/kws_asr/src/UseCaseHandler.cc
+++ b/source/use_case/kws_asr/src/UseCaseHandler.cc
@@ -52,13 +52,7 @@ namespace app {
* @brief Helper function to increment current audio clip index
* @param[in,out] ctx pointer to the application context object
**/
- static void _IncrementAppCtxClipIdx(ApplicationContext& ctx);
-
- /**
- * @brief Helper function to increment current audio clip index
- * @param[in,out] ctx pointer to the application context object
- **/
- static void _IncrementAppCtxClipIdx(ApplicationContext& ctx);
+ static void IncrementAppCtxClipIdx(ApplicationContext& ctx);
/**
* @brief Helper function to set the audio clip index
@@ -66,7 +60,7 @@ namespace app {
* @param[in] idx value to be set
* @return true if index is set, false otherwise
**/
- static bool _SetAppCtxClipIdx(ApplicationContext& ctx, uint32_t idx);
+ static bool SetAppCtxClipIdx(ApplicationContext& ctx, uint32_t idx);
/**
* @brief Presents kws inference results using the data presentation
@@ -77,7 +71,7 @@ namespace app {
* Otherwise, this can be passed in as 0.
* @return true if successful, false otherwise
**/
- static bool _PresentInferenceResult(hal_platform& platform, std::vector<arm::app::kws::KwsResult>& results);
+ static bool PresentInferenceResult(hal_platform& platform, std::vector<arm::app::kws::KwsResult>& results);
/**
* @brief Presents asr inference results using the data presentation
@@ -88,7 +82,7 @@ namespace app {
* Otherwise, this can be passed in as 0.
* @return true if successful, false otherwise
**/
- static bool _PresentInferenceResult(hal_platform& platform, std::vector<arm::app::asr::AsrResult>& results);
+ static bool PresentInferenceResult(hal_platform& platform, std::vector<arm::app::asr::AsrResult>& results);
/**
* @brief Returns a function to perform feature calculation and populates input tensor data with
@@ -212,7 +206,7 @@ namespace app {
std::string str_inf{"Running KWS inference... "};
platform.data_psn->present_data_text(
str_inf.c_str(), str_inf.size(),
- dataPsnTxtInfStartX, dataPsnTxtInfStartY, 0);
+ dataPsnTxtInfStartX, dataPsnTxtInfStartY, false);
info("Running KWS inference on audio clip %u => %s\n",
currentIndex, get_filename(currentIndex));
@@ -279,9 +273,9 @@ namespace app {
str_inf = std::string(str_inf.size(), ' ');
platform.data_psn->present_data_text(
str_inf.c_str(), str_inf.size(),
- dataPsnTxtInfStartX, dataPsnTxtInfStartY, 0);
+ dataPsnTxtInfStartX, dataPsnTxtInfStartY, false);
- if (!_PresentInferenceResult(platform, kwsResults)) {
+ if (!PresentInferenceResult(platform, kwsResults)) {
return output;
}
@@ -375,7 +369,7 @@ namespace app {
std::string str_inf{"Running ASR inference... "};
platform.data_psn->present_data_text(
str_inf.c_str(), str_inf.size(),
- dataPsnTxtInfStartX, dataPsnTxtInfStartY, 0);
+ dataPsnTxtInfStartX, dataPsnTxtInfStartY, false);
size_t asrInferenceWindowLen = asrAudioParamsWinLen;
@@ -425,7 +419,7 @@ namespace app {
str_inf.c_str(), str_inf.size(),
dataPsnTxtInfStartX, dataPsnTxtInfStartY, false);
}
- if (!_PresentInferenceResult(platform, asrResults)) {
+ if (!PresentInferenceResult(platform, asrResults)) {
return false;
}
@@ -442,7 +436,7 @@ namespace app {
/* If the request has a valid size, set the audio index. */
if (clipIndex < NUMBER_OF_FILES) {
- if (!_SetAppCtxClipIdx(ctx, clipIndex)) {
+ if (!SetAppCtxClipIdx(ctx, clipIndex)) {
return false;
}
}
@@ -463,14 +457,14 @@ namespace app {
}
}
- _IncrementAppCtxClipIdx(ctx);
+ IncrementAppCtxClipIdx(ctx);
} while (runAll && ctx.Get<uint32_t>("clipIndex") != startClipIdx);
return true;
}
- static void _IncrementAppCtxClipIdx(ApplicationContext& ctx)
+ static void IncrementAppCtxClipIdx(ApplicationContext& ctx)
{
auto curAudioIdx = ctx.Get<uint32_t>("clipIndex");
@@ -482,7 +476,7 @@ namespace app {
ctx.Set<uint32_t>("clipIndex", curAudioIdx);
}
- static bool _SetAppCtxClipIdx(ApplicationContext& ctx, const uint32_t idx)
+ static bool SetAppCtxClipIdx(ApplicationContext& ctx, uint32_t idx)
{
if (idx >= NUMBER_OF_FILES) {
printf_err("Invalid idx %u (expected less than %u)\n",
@@ -493,8 +487,8 @@ namespace app {
return true;
}
- static bool _PresentInferenceResult(hal_platform& platform,
- std::vector<arm::app::kws::KwsResult>& results)
+ static bool PresentInferenceResult(hal_platform& platform,
+ std::vector<arm::app::kws::KwsResult>& results)
{
constexpr uint32_t dataPsnTxtStartX1 = 20;
constexpr uint32_t dataPsnTxtStartY1 = 30;
@@ -510,7 +504,7 @@ namespace app {
std::string topKeyword{"<none>"};
float score = 0.f;
- if (results[i].m_resultVec.size()) {
+ if (!results[i].m_resultVec.empty()) {
topKeyword = results[i].m_resultVec[0].m_label;
score = results[i].m_resultVec[0].m_normalisedVal;
}
@@ -538,7 +532,7 @@ namespace app {
return true;
}
- static bool _PresentInferenceResult(hal_platform& platform, std::vector<arm::app::asr::AsrResult>& results)
+ static bool PresentInferenceResult(hal_platform& platform, std::vector<arm::app::asr::AsrResult>& results)
{
constexpr uint32_t dataPsnTxtStartX1 = 20;
constexpr uint32_t dataPsnTxtStartY1 = 80;
@@ -587,8 +581,8 @@ namespace app {
**/
template<class T>
std::function<void (std::vector<int16_t>&, size_t, bool, size_t)>
- _FeatureCalc(TfLiteTensor* inputTensor, size_t cacheSize,
- std::function<std::vector<T> (std::vector<int16_t>& )> compute)
+ FeatureCalc(TfLiteTensor* inputTensor, size_t cacheSize,
+ std::function<std::vector<T> (std::vector<int16_t>& )> compute)
{
/* Feature cache to be captured by lambda function. */
static std::vector<std::vector<T>> featureCache = std::vector<std::vector<T>>(cacheSize);
@@ -621,24 +615,24 @@ namespace app {
}
template std::function<void (std::vector<int16_t>&, size_t , bool, size_t)>
- _FeatureCalc<int8_t>(TfLiteTensor* inputTensor,
- size_t cacheSize,
- std::function<std::vector<int8_t> (std::vector<int16_t>& )> compute);
+ FeatureCalc<int8_t>(TfLiteTensor* inputTensor,
+ size_t cacheSize,
+ std::function<std::vector<int8_t> (std::vector<int16_t>& )> compute);
template std::function<void (std::vector<int16_t>&, size_t , bool, size_t)>
- _FeatureCalc<uint8_t>(TfLiteTensor* inputTensor,
- size_t cacheSize,
- std::function<std::vector<uint8_t> (std::vector<int16_t>& )> compute);
+ FeatureCalc<uint8_t>(TfLiteTensor* inputTensor,
+ size_t cacheSize,
+ std::function<std::vector<uint8_t> (std::vector<int16_t>& )> compute);
template std::function<void (std::vector<int16_t>&, size_t , bool, size_t)>
- _FeatureCalc<int16_t>(TfLiteTensor* inputTensor,
- size_t cacheSize,
- std::function<std::vector<int16_t> (std::vector<int16_t>& )> compute);
+ FeatureCalc<int16_t>(TfLiteTensor* inputTensor,
+ size_t cacheSize,
+ std::function<std::vector<int16_t> (std::vector<int16_t>& )> compute);
template std::function<void(std::vector<int16_t>&, size_t, bool, size_t)>
- _FeatureCalc<float>(TfLiteTensor* inputTensor,
- size_t cacheSize,
- std::function<std::vector<float>(std::vector<int16_t>&)> compute);
+ FeatureCalc<float>(TfLiteTensor* inputTensor,
+ size_t cacheSize,
+ std::function<std::vector<float>(std::vector<int16_t>&)> compute);
static std::function<void (std::vector<int16_t>&, int, bool, size_t)>
@@ -656,35 +650,35 @@ namespace app {
switch (inputTensor->type) {
case kTfLiteInt8: {
- mfccFeatureCalc = _FeatureCalc<int8_t>(inputTensor,
- cacheSize,
- [=, &mfcc](std::vector<int16_t>& audioDataWindow) {
- return mfcc.MfccComputeQuant<int8_t>(audioDataWindow,
- quantScale,
- quantOffset);
- }
+ mfccFeatureCalc = FeatureCalc<int8_t>(inputTensor,
+ cacheSize,
+ [=, &mfcc](std::vector<int16_t>& audioDataWindow) {
+ return mfcc.MfccComputeQuant<int8_t>(audioDataWindow,
+ quantScale,
+ quantOffset);
+ }
);
break;
}
case kTfLiteUInt8: {
- mfccFeatureCalc = _FeatureCalc<uint8_t>(inputTensor,
- cacheSize,
- [=, &mfcc](std::vector<int16_t>& audioDataWindow) {
- return mfcc.MfccComputeQuant<uint8_t>(audioDataWindow,
- quantScale,
- quantOffset);
- }
+ mfccFeatureCalc = FeatureCalc<uint8_t>(inputTensor,
+ cacheSize,
+ [=, &mfcc](std::vector<int16_t>& audioDataWindow) {
+ return mfcc.MfccComputeQuant<uint8_t>(audioDataWindow,
+ quantScale,
+ quantOffset);
+ }
);
break;
}
case kTfLiteInt16: {
- mfccFeatureCalc = _FeatureCalc<int16_t>(inputTensor,
- cacheSize,
- [=, &mfcc](std::vector<int16_t>& audioDataWindow) {
- return mfcc.MfccComputeQuant<int16_t>(audioDataWindow,
- quantScale,
- quantOffset);
- }
+ mfccFeatureCalc = FeatureCalc<int16_t>(inputTensor,
+ cacheSize,
+ [=, &mfcc](std::vector<int16_t>& audioDataWindow) {
+ return mfcc.MfccComputeQuant<int16_t>(audioDataWindow,
+ quantScale,
+ quantOffset);
+ }
);
break;
}
@@ -694,11 +688,11 @@ namespace app {
} else {
- mfccFeatureCalc = mfccFeatureCalc = _FeatureCalc<float>(inputTensor,
- cacheSize,
- [&mfcc](std::vector<int16_t>& audioDataWindow) {
- return mfcc.MfccCompute(audioDataWindow);
- });
+ mfccFeatureCalc = mfccFeatureCalc = FeatureCalc<float>(inputTensor,
+ cacheSize,
+ [&mfcc](std::vector<int16_t>& audioDataWindow) {
+ return mfcc.MfccCompute(audioDataWindow);
+ });
}
return mfccFeatureCalc;
}
diff --git a/source/use_case/kws_asr/src/Wav2LetterMfcc.cc b/source/use_case/kws_asr/src/Wav2LetterMfcc.cc
index 80e4a26..ae9e57a 100644
--- a/source/use_case/kws_asr/src/Wav2LetterMfcc.cc
+++ b/source/use_case/kws_asr/src/Wav2LetterMfcc.cc
@@ -27,8 +27,8 @@ namespace audio {
bool Wav2LetterMFCC::ApplyMelFilterBank(
std::vector<float>& fftVec,
std::vector<std::vector<float>>& melFilterBank,
- std::vector<int32_t>& filterBankFilterFirst,
- std::vector<int32_t>& filterBankFilterLast,
+ std::vector<uint32_t>& filterBankFilterFirst,
+ std::vector<uint32_t>& filterBankFilterLast,
std::vector<float>& melEnergies)
{
const size_t numBanks = melEnergies.size();
@@ -41,11 +41,14 @@ namespace audio {
for (size_t bin = 0; bin < numBanks; ++bin) {
auto filterBankIter = melFilterBank[bin].begin();
- float melEnergy = 1e-10; /* Avoid log of zero at later stages, same value used in librosa. */
- const int32_t firstIndex = filterBankFilterFirst[bin];
- const int32_t lastIndex = filterBankFilterLast[bin];
-
- for (int32_t i = firstIndex; i <= lastIndex; ++i) {
+ auto end = melFilterBank[bin].end();
+ /* Avoid log of zero at later stages, same value used in librosa.
+ * The number was used during our default wav2letter model training. */
+ float melEnergy = 1e-10;
+ const uint32_t firstIndex = filterBankFilterFirst[bin];
+ const uint32_t lastIndex = std::min<uint32_t>(filterBankFilterLast[bin], fftVec.size() - 1);
+
+ for (uint32_t i = firstIndex; i <= lastIndex && filterBankIter != end; ++i) {
melEnergy += (*filterBankIter++ * fftVec[i]);
}
@@ -73,7 +76,7 @@ namespace audio {
/* Scale the log values and get the max. */
for (auto iterM = melEnergies.begin(), iterL = vecLogEnergies.begin();
- iterM != melEnergies.end(); ++iterM, ++iterL) {
+ iterM != melEnergies.end() && iterL != vecLogEnergies.end(); ++iterM, ++iterL) {
*iterM = *iterL * multiplier;
@@ -86,8 +89,8 @@ namespace audio {
/* Clamp the mel energies. */
constexpr float maxDb = 80.0;
const float clampLevelLowdB = maxMelEnergy - maxDb;
- for (auto iter = melEnergies.begin(); iter != melEnergies.end(); ++iter) {
- *iter = std::max(*iter, clampLevelLowdB);
+ for (float & melEnergie : melEnergies) {
+ melEnergie = std::max(melEnergie, clampLevelLowdB);
}
}
diff --git a/source/use_case/kws_asr/src/Wav2LetterPostprocess.cc b/source/use_case/kws_asr/src/Wav2LetterPostprocess.cc
index b173968..ee3aba0 100644
--- a/source/use_case/kws_asr/src/Wav2LetterPostprocess.cc
+++ b/source/use_case/kws_asr/src/Wav2LetterPostprocess.cc
@@ -38,13 +38,13 @@ namespace asr {
const bool lastIteration)
{
/* Basic checks. */
- if (!this->_IsInputValid(tensor, axisIdx)) {
+ if (!this->IsInputValid(tensor, axisIdx)) {
return false;
}
/* Irrespective of tensor type, we use unsigned "byte" */
uint8_t* ptrData = tflite::GetTensorData<uint8_t>(tensor);
- const uint32_t elemSz = this->_GetTensorElementSize(tensor);
+ const uint32_t elemSz = this->GetTensorElementSize(tensor);
/* Other sanity checks. */
if (0 == elemSz) {
@@ -58,9 +58,10 @@ namespace asr {
/* Which axis do we need to process? */
switch (axisIdx) {
case arm::app::Wav2LetterModel::ms_outputRowsIdx:
- return this->_EraseSectionsRowWise(ptrData,
- elemSz * tensor->dims->data[arm::app::Wav2LetterModel::ms_outputColsIdx],
- lastIteration);
+ return this->EraseSectionsRowWise(ptrData,
+ elemSz *
+ tensor->dims->data[arm::app::Wav2LetterModel::ms_outputColsIdx],
+ lastIteration);
default:
printf_err("Unsupported axis index: %u\n", axisIdx);
}
@@ -68,8 +69,8 @@ namespace asr {
return false;
}
- bool Postprocess::_IsInputValid(TfLiteTensor* tensor,
- const uint32_t axisIdx) const
+ bool Postprocess::IsInputValid(TfLiteTensor* tensor,
+ const uint32_t axisIdx) const
{
if (nullptr == tensor) {
return false;
@@ -91,7 +92,7 @@ namespace asr {
return true;
}
- uint32_t Postprocess::_GetTensorElementSize(TfLiteTensor* tensor)
+ uint32_t Postprocess::GetTensorElementSize(TfLiteTensor* tensor)
{
switch(tensor->type) {
case kTfLiteUInt8:
@@ -112,7 +113,7 @@ namespace asr {
return 0;
}
- bool Postprocess::_EraseSectionsRowWise(
+ bool Postprocess::EraseSectionsRowWise(
uint8_t* ptrData,
const uint32_t strideSzBytes,
const bool lastIteration)
diff --git a/source/use_case/kws_asr/src/Wav2LetterPreprocess.cc b/source/use_case/kws_asr/src/Wav2LetterPreprocess.cc
index 613ddb0..8251396 100644
--- a/source/use_case/kws_asr/src/Wav2LetterPreprocess.cc
+++ b/source/use_case/kws_asr/src/Wav2LetterPreprocess.cc
@@ -88,12 +88,12 @@ namespace asr {
}
/* Compute first and second order deltas from MFCCs. */
- this->_ComputeDeltas(this->_m_mfccBuf,
- this->_m_delta1Buf,
- this->_m_delta2Buf);
+ this->ComputeDeltas(this->_m_mfccBuf,
+ this->_m_delta1Buf,
+ this->_m_delta2Buf);
/* Normalise. */
- this->_Normalise();
+ this->Normalise();
/* Quantise. */
QuantParams quantParams = GetTensorQuantParams(tensor);
@@ -105,11 +105,11 @@ namespace asr {
switch(tensor->type) {
case kTfLiteUInt8:
- return this->_Quantise<uint8_t>(
+ return this->Quantise<uint8_t>(
tflite::GetTensorData<uint8_t>(tensor), tensor->bytes,
quantParams.scale, quantParams.offset);
case kTfLiteInt8:
- return this->_Quantise<int8_t>(
+ return this->Quantise<int8_t>(
tflite::GetTensorData<int8_t>(tensor), tensor->bytes,
quantParams.scale, quantParams.offset);
default:
@@ -120,9 +120,9 @@ namespace asr {
return false;
}
- bool Preprocess::_ComputeDeltas(Array2d<float>& mfcc,
- Array2d<float>& delta1,
- Array2d<float>& delta2)
+ bool Preprocess::ComputeDeltas(Array2d<float>& mfcc,
+ Array2d<float>& delta1,
+ Array2d<float>& delta2)
{
const std::vector <float> delta1Coeffs =
{6.66666667e-02, 5.00000000e-02, 3.33333333e-02,
@@ -175,20 +175,20 @@ namespace asr {
return true;
}
- float Preprocess::_GetMean(Array2d<float>& vec)
+ float Preprocess::GetMean(Array2d<float>& vec)
{
return math::MathUtils::MeanF32(vec.begin(), vec.totalSize());
}
- float Preprocess::_GetStdDev(Array2d<float>& vec, const float mean)
+ float Preprocess::GetStdDev(Array2d<float>& vec, const float mean)
{
return math::MathUtils::StdDevF32(vec.begin(), vec.totalSize(), mean);
}
- void Preprocess::_NormaliseVec(Array2d<float>& vec)
+ void Preprocess::NormaliseVec(Array2d<float>& vec)
{
- auto mean = Preprocess::_GetMean(vec);
- auto stddev = Preprocess::_GetStdDev(vec, mean);
+ auto mean = Preprocess::GetMean(vec);
+ auto stddev = Preprocess::GetStdDev(vec, mean);
debug("Mean: %f, Stddev: %f\n", mean, stddev);
if (stddev == 0) {
@@ -204,14 +204,14 @@ namespace asr {
}
}
- void Preprocess::_Normalise()
+ void Preprocess::Normalise()
{
- Preprocess::_NormaliseVec(this->_m_mfccBuf);
- Preprocess::_NormaliseVec(this->_m_delta1Buf);
- Preprocess::_NormaliseVec(this->_m_delta2Buf);
+ Preprocess::NormaliseVec(this->_m_mfccBuf);
+ Preprocess::NormaliseVec(this->_m_delta1Buf);
+ Preprocess::NormaliseVec(this->_m_delta2Buf);
}
- float Preprocess::_GetQuantElem(
+ float Preprocess::GetQuantElem(
const float elem,
const float quantScale,
const int quantOffset,