diff options
author | Isabella Gottardi <isabella.gottardi@arm.com> | 2021-10-15 10:17:33 +0100 |
---|---|---|
committer | Isabella Gottardi <isabella.gottardi@arm.com> | 2021-10-15 10:33:19 +0100 |
commit | 5cbcd9e2c85485db1fe8cf7b2445550e9dc36800 (patch) | |
tree | d42ed9864743202c36f90e9b7c5f5777e75d0a0f /tests/use_case/vww | |
parent | 118f73e0396fe66ee5cc3c0daec0882c7160a7cb (diff) | |
download | ml-embedded-evaluation-kit-5cbcd9e2c85485db1fe8cf7b2445550e9dc36800.tar.gz |
MLECO-2423: [Fix] Case insensitive name clash
* Fixed vww usage warnings (imageData in RunInferene and _GetImageIdx function)
Change-Id: I2c37e4e4cc8c8eca841690f2df8d525ed516ecc8
Diffstat (limited to 'tests/use_case/vww')
-rw-r--r-- | tests/use_case/vww/InferenceVisualWakeWordModelTests.cc | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/tests/use_case/vww/InferenceVisualWakeWordModelTests.cc b/tests/use_case/vww/InferenceVisualWakeWordModelTests.cc index c109a62..3a42dde 100644 --- a/tests/use_case/vww/InferenceVisualWakeWordModelTests.cc +++ b/tests/use_case/vww/InferenceVisualWakeWordModelTests.cc @@ -15,21 +15,29 @@ * limitations under the License. */ -#include <catch.hpp> -#include <random> #include "hal.h" -#include "InputFiles.hpp" #include "ImageUtils.hpp" #include "TestData_vww.hpp" #include "VisualWakeWordModel.hpp" #include "TensorFlowLiteMicro.hpp" +#include <catch.hpp> bool RunInference(arm::app::Model& model, const int8_t* imageData) { TfLiteTensor* inputTensor = model.GetInputTensor(0); REQUIRE(inputTensor); + const size_t copySz = inputTensor->bytes < IFM_DATA_SIZE ? + inputTensor->bytes : + IFM_DATA_SIZE; + + memcpy(inputTensor->data.data, imageData, copySz); + + if(model.IsDataSigned()){ + convertImgIoInt8(inputTensor->data.data, copySz); + } + return model.RunInference(); } @@ -54,28 +62,3 @@ void TestInference(int imageIdx,arm::app::Model& model) { CHECK(testVal == goldenVal); } } - - -/** - * @brief Given an image name, get its index - * @param[in] imageName Name of the image expected - * @return index of the image if valid and (-1) if not found - */ -static int _GetImageIdx(std::string &imageName) -{ - int imgIdx = -1; - for (uint32_t i = 0 ; i < NUMBER_OF_FILES; ++i) { - if (imageName == std::string(get_filename(i))) { - info("Image %s exists at index %u\n", get_filename(i), i); - imgIdx = static_cast<int>(i); - break; - } - } - - if (-1 == imgIdx) { - warn("Image %s not found!\n", imageName.c_str()); - } - - return imgIdx; -} - |