summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKwanghoon Son <k.son@samsung.com>2022-09-02 01:29:40 -0400
committerInki Dae <inki.dae@samsung.com>2022-09-02 17:09:25 +0900
commitfe02f05b54290d93405eda7403675a335d162d05 (patch)
tree2d3796a7839eea11b0e688f097d721b5e058ca7b
parentcd69a17b23173da1ad3a139fad11183d1f8dd360 (diff)
downloadmediavision-fe02f05b54290d93405eda7403675a335d162d05.tar.gz
mediavision-fe02f05b54290d93405eda7403675a335d162d05.tar.bz2
mediavision-fe02f05b54290d93405eda7403675a335d162d05.zip
Add SNPE efficient net test
[Issue type] new test Change-Id: Ia141001c1957709075da62416e6d4c0c6dc89916 Signed-off-by: Kwanghoon Son <k.son@samsung.com>
-rw-r--r--test/testsuites/machine_learning/inference/test_object_detection.cpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/test/testsuites/machine_learning/inference/test_object_detection.cpp b/test/testsuites/machine_learning/inference/test_object_detection.cpp
index 7e685d61..42c0c482 100644
--- a/test/testsuites/machine_learning/inference/test_object_detection.cpp
+++ b/test/testsuites/machine_learning/inference/test_object_detection.cpp
@@ -12,16 +12,22 @@
#define IMG_DOG \
MV_CONFIG_PATH \
"/res/inference/images/dog2.jpg"
+#define OD_LABEL_EFFICIENTDET_LITE2_448_PATH \
+ MV_CONFIG_PATH \
+ "models/OD/snpe/label_coco_90.txt"
+#define OD_SNPE_WEIGHT_QC_EFFCIENTDET_LITE2_448_PATH \
+ MV_CONFIG_PATH \
+ "/models/OD/snpe/lite2_fp32.dlc"
void _object_detected_cb(mv_source_h source, const int number_of_objects,
const int *indices, const char **names,
const float *confidences,
const mv_rectangle_s *locations, void *user_data)
{
- const std::string answer = "Dog";
+ auto answer = static_cast<std::string *>(user_data);
auto answer_found = false;
for (int i = 0; i < number_of_objects; i++) {
- if (answer == names[i]) {
+ if (*answer == names[i]) {
answer_found = true;
break;
}
@@ -34,13 +40,14 @@ class TestObjectDetectionTflite : public TestInference
public:
void inferenceDog()
{
+ std::string result("Dog");
TestInference::ConfigureInference();
ASSERT_EQ(MediaVision::Common::ImageHelper::loadImageToSource(
IMG_DOG, mv_source),
MEDIA_VISION_ERROR_NONE);
ASSERT_EQ(mv_inference_object_detect(mv_source, infer,
- _object_detected_cb, NULL),
+ _object_detected_cb, &result),
MEDIA_VISION_ERROR_NONE);
}
};
@@ -95,3 +102,35 @@ INSTANTIATE_TEST_CASE_P(
Prefix, TestObjectDetectionTflite,
::testing::Values(ParamTypes(false, MV_INFERENCE_TARGET_DEVICE_CPU),
ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_CPU)));
+
+class TestObjectDetectionSnpe : public TestInference
+{
+public:
+ void inferenceDog()
+ {
+ std::string result("dog");
+ TestInference::ConfigureInference();
+
+ ASSERT_EQ(MediaVision::Common::ImageHelper::loadImageToSource(
+ IMG_DOG, mv_source),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_inference_object_detect(mv_source, infer,
+ _object_detected_cb, &result),
+ MEDIA_VISION_ERROR_NONE);
+ }
+};
+
+TEST_P(TestObjectDetectionSnpe, DISABLED_EFDLite2QC)
+{
+ ASSERT_TRUE(_use_json_parser);
+ engine_config_hosted_snpe_model(
+ engine_cfg, OD_SNPE_WEIGHT_QC_EFFCIENTDET_LITE2_448_PATH,
+ OD_LABEL_EFFICIENTDET_LITE2_448_PATH, _use_json_parser,
+ _target_device_type);
+
+ inferenceDog();
+}
+
+INSTANTIATE_TEST_CASE_P(
+ Prefix, TestObjectDetectionSnpe,
+ ::testing::Values(ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_CUSTOM))); \ No newline at end of file