diff options
author | Isabella Gottardi <isabella.gottardi@arm.com> | 2021-04-07 09:27:38 +0100 |
---|---|---|
committer | Isabella Gottardi <isabella.gottardi@arm.com> | 2021-05-07 12:19:19 +0100 |
commit | 2181d0ac35f30202985a877950c88325ff665f6b (patch) | |
tree | e16c50d41d85945e0c2c864323ac1769b02af64f /tests/use_case/ad/InferenceTestAD.cc | |
parent | d580eee180be219e118152cedabc9637da8574d6 (diff) | |
download | ml-embedded-evaluation-kit-2181d0ac35f30202985a877950c88325ff665f6b.tar.gz |
MLECO-1766: Default build flow helper scripts added
MLECO-1882: Anomaly Detection use-case default model download added
and tests updated to run with it.
Test data generation cmake logic moved from use-case cmakes to top-level cmake script.
Signed-off-by: Isabella Gottardi <isabella.gottardi@arm.com>
Change-Id: Ifde469e3585c37b9a53810236a92ce52d4fbb407
Diffstat (limited to 'tests/use_case/ad/InferenceTestAD.cc')
-rw-r--r-- | tests/use_case/ad/InferenceTestAD.cc | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/tests/use_case/ad/InferenceTestAD.cc b/tests/use_case/ad/InferenceTestAD.cc index b87699d..d5e21c2 100644 --- a/tests/use_case/ad/InferenceTestAD.cc +++ b/tests/use_case/ad/InferenceTestAD.cc @@ -19,7 +19,7 @@ #include <random> #include "AdModel.hpp" -#include "AdGoldenInput.hpp" +#include "TestData_ad.hpp" #include "hal.h" #include "TensorFlowLiteMicro.hpp" @@ -27,6 +27,8 @@ #define AD_IN_FEATURE_VEC_DATA_SIZE (1024) #endif /* AD_FEATURE_VEC_DATA_SIZE */ +using namespace test; + bool RunInference(arm::app::Model& model, const int8_t vec[]) { TfLiteTensor *inputTensor = model.GetInputTensor(0); @@ -67,7 +69,7 @@ void TestInference(const T *input_goldenFV, const T *output_goldenFV, arm::app:: TfLiteTensor *outputTensor = model.GetOutputTensor(0); REQUIRE(outputTensor); - REQUIRE(outputTensor->bytes == AD_OUT_FEATURE_VEC_DATA_SIZE); + REQUIRE(outputTensor->bytes == OFM_DATA_SIZE); auto tensorData = tflite::GetTensorData<T>(outputTensor); REQUIRE(tensorData); @@ -77,7 +79,7 @@ void TestInference(const T *input_goldenFV, const T *output_goldenFV, arm::app:: } } -TEST_CASE("Running random inference with TensorFlow Lite Micro and AdModel Int8", "[AD][.]") +TEST_CASE("Running random inference with TensorFlow Lite Micro and AdModel Int8", "[AD]") { arm::app::AdModel model{}; @@ -88,13 +90,22 @@ TEST_CASE("Running random inference with TensorFlow Lite Micro and AdModel Int8" REQUIRE(RunInferenceRandom(model)); } -TEST_CASE("Running golden vector inference with TensorFlow Lite Micro and AdModel Int8", "[AD][.]") +TEST_CASE("Running golden vector inference with TensorFlow Lite Micro and AdModel Int8", "[AD]") { - arm::app::AdModel model{}; + for (uint32_t i = 0 ; i < NUMBER_OF_FM_FILES; ++i) { + auto input_goldenFV = get_ifm_data_array(i);; + auto output_goldenFV = get_ofm_data_array(i); - REQUIRE_FALSE(model.IsInited()); - REQUIRE(model.Init()); - REQUIRE(model.IsInited()); + DYNAMIC_SECTION("Executing inference with re-init") + { + arm::app::AdModel model{}; + + REQUIRE_FALSE(model.IsInited()); + REQUIRE(model.Init()); + REQUIRE(model.IsInited()); - TestInference(ad_golden_input, ad_golden_out, model); + TestInference<int8_t>(input_goldenFV, output_goldenFV, model); + + } + } }
\ No newline at end of file |