#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;
}
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);
}
};
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