From e958850d7672cd81a5eb48285a2df94b8f0595f0 Mon Sep 17 00:00:00 2001 From: Liam Barry Date: Tue, 25 Jan 2022 14:31:15 +0000 Subject: MLECO-2872 Minor improvement to CommonUseCaseUtils Replaced overloaded PresentInferenceresults with single function and removed logic to handle arguments which are no longer passed. Change-Id: I745271638fcf78b7121c2a4b95844b752643bac2 Signed-off-by: Liam Barry --- source/application/main/UseCaseCommonUtils.cc | 41 +++------------------- .../main/include/UseCaseCommonUtils.hpp | 28 +-------------- source/use_case/vww/src/UseCaseHandler.cc | 4 +-- 3 files changed, 7 insertions(+), 66 deletions(-) diff --git a/source/application/main/UseCaseCommonUtils.cc b/source/application/main/UseCaseCommonUtils.cc index becfc93..d740d10 100644 --- a/source/application/main/UseCaseCommonUtils.cc +++ b/source/application/main/UseCaseCommonUtils.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Arm Limited. All rights reserved. + * Copyright (c) 2021-2022 Arm Limited. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,25 +44,10 @@ void image::ConvertImgToInt8(void* data, const size_t kMaxImageSize) } } -bool image::PresentInferenceResult(hal_platform& platform, - const std::vector& results) -{ - return PresentInferenceResult(platform, results, false); -} - -bool image::PresentInferenceResult(hal_platform &platform, - const std::vector &results, - const time_t infTimeMs) -{ - return PresentInferenceResult(platform, results, true, infTimeMs); -} - bool image::PresentInferenceResult( hal_platform &platform, - const std::vector &results, - bool profilingEnabled, - const time_t infTimeMs) + const std::vector &results) { constexpr uint32_t dataPsnTxtStartX1 = 150; constexpr uint32_t dataPsnTxtStartY1 = 30; @@ -72,32 +57,14 @@ bool image::PresentInferenceResult( constexpr uint32_t dataPsnTxtYIncr = 16; /* Row index increment. */ - if (profilingEnabled) { - platform.data_psn->set_text_color(COLOR_YELLOW); - - /* If profiling is enabled, and the time is valid. */ - info("Final results:\n"); - info("Total number of inferences: 1\n"); - if (infTimeMs) { - std::string strInf = - std::string{"Inference: "} + - std::to_string(infTimeMs) + - std::string{"ms"}; - platform.data_psn->present_data_text( - strInf.c_str(), strInf.size(), - dataPsnTxtStartX1, dataPsnTxtStartY1, 0); - } - } platform.data_psn->set_text_color(COLOR_GREEN); /* Display each result. */ uint32_t rowIdx1 = dataPsnTxtStartY1 + 2 * dataPsnTxtYIncr; uint32_t rowIdx2 = dataPsnTxtStartY2; - if (!profilingEnabled) { - info("Final results:\n"); - info("Total number of inferences: 1\n"); - } + info("Final results:\n"); + info("Total number of inferences: 1\n"); for (uint32_t i = 0; i < results.size(); ++i) { std::string resultStr = diff --git a/source/application/main/include/UseCaseCommonUtils.hpp b/source/application/main/include/UseCaseCommonUtils.hpp index a3b606d..c91dc4a 100644 --- a/source/application/main/include/UseCaseCommonUtils.hpp +++ b/source/application/main/include/UseCaseCommonUtils.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Arm Limited. All rights reserved. + * Copyright (c) 2021-2022 Arm Limited. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -57,32 +57,6 @@ namespace image{ **/ bool PresentInferenceResult(hal_platform & platform, const std::vector < arm::app::ClassificationResult > & results); - - - /** - * @brief Presents inference results along with the inference time using the data presentation - * object. - * @param[in] platform Reference to the hal platform object. - * @param[in] results Vector of classification results to be displayed. - * @param[in] results Inference time in ms. - * @return true if successful, false otherwise. - **/ - bool PresentInferenceResult(hal_platform & platform, - const std::vector < arm::app::ClassificationResult > & results, - const time_t infTimeMs); - - /** - * @brief Presents inference results along with the inference time using the data presentation - * object. - * @param[in] platform Reference to the hal platform object. - * @param[in] results Vector of classification results to be displayed. - * @param[in] results Inference time in ms. - * @return true if successful, false otherwise. - **/ - bool PresentInferenceResult(hal_platform & platform, - const std::vector < arm::app::ClassificationResult > & results, - bool profilingEnabled, - const time_t infTimeMs = 0); } /** diff --git a/source/use_case/vww/src/UseCaseHandler.cc b/source/use_case/vww/src/UseCaseHandler.cc index 8165bb0..dbfe92b 100644 --- a/source/use_case/vww/src/UseCaseHandler.cc +++ b/source/use_case/vww/src/UseCaseHandler.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Arm Limited. All rights reserved. + * Copyright (c) 2021-2022 Arm Limited. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -140,7 +140,7 @@ namespace app { arm::app::DumpTensor(outputTensor); #endif /* VERIFY_TEST_OUTPUT */ - if (!image::PresentInferenceResult(platform, results, infTimeMs)) { + if (!image::PresentInferenceResult(platform, results)) { return false; } -- cgit v1.2.1