diff options
author | Isabella Gottardi <isabella.gottardi@arm.com> | 2021-04-07 17:15:31 +0100 |
---|---|---|
committer | Alexander Efremov <alexander.efremov@arm.com> | 2021-04-12 14:00:49 +0000 |
commit | 8df12f37531d57a10cba2f8b2e8b6a9065202dd5 (patch) | |
tree | ba833d15649c3b0f885d57b40d3916970b3fd2c8 /source/use_case/asr/src/UseCaseHandler.cc | |
parent | 37ce22ebc9cf3e8529d9914c0eed0f718243d961 (diff) | |
download | ml-embedded-evaluation-kit-8df12f37531d57a10cba2f8b2e8b6a9065202dd5.tar.gz |
MLECO-1870: Cherry pick profiling changes from dev to open source repo
* Documentation update
Change-Id: If85e7ebc44498840b291c408f14e66a5a5faa424
Signed-off-by: Isabella Gottardi <isabella.gottardi@arm.com>
Diffstat (limited to 'source/use_case/asr/src/UseCaseHandler.cc')
-rw-r--r-- | source/use_case/asr/src/UseCaseHandler.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/use_case/asr/src/UseCaseHandler.cc b/source/use_case/asr/src/UseCaseHandler.cc index e706eb8..5d3157a 100644 --- a/source/use_case/asr/src/UseCaseHandler.cc +++ b/source/use_case/asr/src/UseCaseHandler.cc @@ -67,6 +67,8 @@ namespace app { auto& platform = ctx.Get<hal_platform&>("platform"); platform.data_psn->clear(COLOR_BLACK); + auto& profiler = ctx.Get<Profiler&>("profiler"); + /* If the request has a valid size, set the audio index. */ if (clipIndex < NUMBER_OF_FILES) { if (!_SetAppCtxClipIdx(ctx, clipIndex)) { @@ -168,18 +170,11 @@ namespace app { info("Inference %zu/%zu\n", audioDataSlider.Index() + 1, static_cast<size_t>(ceilf(audioDataSlider.FractionalTotalStrides() + 1))); - Profiler prepProfiler{&platform, "pre-processing"}; - prepProfiler.StartProfiling(); - /* Calculate MFCCs, deltas and populate the input tensor. */ prep.Invoke(inferenceWindow, inferenceWindowLen, inputTensor); - prepProfiler.StopProfiling(); - std::string prepProfileResults = prepProfiler.GetResultsAndReset(); - info("%s\n", prepProfileResults.c_str()); - /* Run inference over this audio clip sliding window. */ - arm::app::RunInference(platform, model); + arm::app::RunInference(model, profiler); /* Post-process. */ postp.Invoke(outputTensor, reductionAxis, !audioDataSlider.HasNext()); @@ -216,6 +211,8 @@ namespace app { return false; } + profiler.PrintProfilingResult(); + _IncrementAppCtxClipIdx(ctx); } while (runAll && ctx.Get<uint32_t>("clipIndex") != startClipIdx); @@ -256,6 +253,8 @@ namespace app { platform.data_psn->set_text_color(COLOR_GREEN); + info("Final results:\n"); + info("Total number of inferences: %zu\n", results.size()); /* Results from multiple inferences should be combined before processing. */ std::vector<arm::app::ClassificationResult> combinedResults; for (auto& result : results) { @@ -268,8 +267,9 @@ namespace app { for (const auto & result : results) { std::string infResultStr = audio::asr::DecodeOutput(result.m_resultVec); - info("Result for inf %u: %s\n", result.m_inferenceNumber, - infResultStr.c_str()); + info("For timestamp: %f (inference #: %u); label: %s\n", + result.m_timeStamp, result.m_inferenceNumber, + infResultStr.c_str()); } /* Get the decoded result for the combined result. */ @@ -280,7 +280,7 @@ namespace app { dataPsnTxtStartX1, dataPsnTxtStartY1, allow_multiple_lines); - info("Final result: %s\n", finalResultStr.c_str()); + info("Complete recognition: %s\n", finalResultStr.c_str()); return true; } |