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
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 @@
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 @@
}
}
-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 @@
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{};
- TestInference(ad_golden_input, ad_golden_out, model);
+ REQUIRE_FALSE(model.IsInited());
+ REQUIRE(model.Init());
+ REQUIRE(model.IsInited());
+
+ TestInference<int8_t>(input_goldenFV, output_goldenFV, model);
+
+ }
+ }
}
\ No newline at end of file