Name: capi-media-vision
Summary: Media Vision library for Tizen Native API
-Version: 0.14.0
+Version: 0.15.0
Release: 0
Group: Multimedia/Framework
License: Apache-2.0 and BSD-3-Clause
EXPECT_GT(number_of_faces, 0);
}
-class TestFaceDetection : public TestInference
+class TestFaceDetectionTflite : public TestInference
{
public:
void inferenceFace()
{
- ASSERT_EQ(mv_inference_configure(infer, engine_cfg),
- MEDIA_VISION_ERROR_NONE);
+ TestInference::ConfigureInference();
- ASSERT_EQ(mv_inference_prepare(infer), MEDIA_VISION_ERROR_NONE);
ASSERT_EQ(MediaVision::Common::ImageHelper::loadImageToSource(
IMG_FACE, mv_source),
MEDIA_VISION_ERROR_NONE);
}
};
-TEST_P(TestFaceDetection, CPU_TFLITE_MobilenetV1_SSD)
+TEST_P(TestFaceDetectionTflite, MobilenetV1_SSD)
{
- engine_config_hosted_model_config(engine_cfg,
- FD_TFLITE_WEIGHT_MOBILENET_V1_SSD_300_PATH, _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, FD_TFLITE_WEIGHT_MOBILENET_V1_SSD_300_PATH,
+ NULL, _use_json_parser, _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "normalized_input_image_tensor";
const char *outputNodeName[] = { "TFLite_Detection_PostProcess",
inferenceFace();
}
-INSTANTIATE_TEST_CASE_P(Prefix, TestFaceDetection,
+INSTANTIATE_TEST_CASE_P(Prefix, TestFaceDetectionTflite,
::testing::Values(
- ParamTypeOne(false),
- ParamTypeOne(true)
+ ParamTypes(false, MV_INFERENCE_TARGET_DEVICE_CPU),
+ ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_CPU)
)
);
\ No newline at end of file
EXPECT_GT(number_of_landmarks, 0);
}
-class TestFaceLandmarkDetection : public TestInference
+class TestFaceLandmarkDetectionOpenCV : public TestInference
{
public:
void inferenceFaceLandmark()
{
- ASSERT_EQ(mv_inference_configure(infer, engine_cfg),
- MEDIA_VISION_ERROR_NONE);
- ASSERT_EQ(mv_inference_prepare(infer), MEDIA_VISION_ERROR_NONE);
+ TestInference::ConfigureInference();
+
ASSERT_EQ(MediaVision::Common::ImageHelper::loadImageToSource(
IMG_FACE_LANDMARK, mv_source),
MEDIA_VISION_ERROR_NONE);
}
};
-TEST_P(TestFaceLandmarkDetection, CPU_OPENCV_CAFFE_CNNCASCADE)
+TEST_P(TestFaceLandmarkDetectionOpenCV, CAFFE_CNNCASCADE)
{
const char *inputNodeName = "data";
const char *outputNodeName[] = { "Sigmoid_fc2" };
inferenceFaceLandmark();
}
-INSTANTIATE_TEST_CASE_P(Prefix, TestFaceLandmarkDetection,
+INSTANTIATE_TEST_CASE_P(Prefix, TestFaceLandmarkDetectionOpenCV,
::testing::Values(
- ParamTypeOne(false),
- ParamTypeOne(true)
+ ParamTypes(false, MV_INFERENCE_TARGET_DEVICE_CPU),
+ ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_CPU)
)
);
\ No newline at end of file
EXPECT_TRUE(answer_found);
}
-class TestImageClassification : public TestInference
+class TestImageClassificationTflite : public TestInference
{
public:
void inferenceBanana()
{
- ASSERT_EQ(mv_inference_configure(infer, engine_cfg),
+ TestInference::ConfigureInference();
+
+ ASSERT_EQ(MediaVision::Common::ImageHelper::loadImageToSource(IMG_BANANA, mv_source),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_inference_image_classify(mv_source, infer, NULL,
+ _image_classified_cb, NULL),
MEDIA_VISION_ERROR_NONE);
- ASSERT_EQ(mv_inference_prepare(infer), MEDIA_VISION_ERROR_NONE);
+ }
+};
+
+class TestImageClassificationSnpe : public TestInference
+{
+public:
+ void inferenceBanana()
+ {
+ TestInference::ConfigureInference();
+
ASSERT_EQ(MediaVision::Common::ImageHelper::loadImageToSource(
IMG_BANANA, mv_source),
MEDIA_VISION_ERROR_NONE);
}
};
-TEST_P(TestImageClassification, CPU_TFLITE_MobilenetV1)
+TEST_P(TestImageClassificationTflite, MobilenetV1)
{
- engine_config_hosted_cpu_tflite_user_model(
- engine_cfg, IC_TFLITE_WEIGHT_MOBILENET_V1_224_PATH,
- IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, IC_TFLITE_WEIGHT_MOBILENET_V1_224_PATH,
+ IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser,
+ _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "input";
inferenceBanana();
}
-TEST_P(TestImageClassification, CPU_TFLITE_MobilenetV2)
+TEST_P(TestImageClassificationTflite, MobilenetV2)
{
- engine_config_hosted_cpu_tflite_user_model(
- engine_cfg, IC_TFLITE_WEIGHT_MOBILENET_V2_224_PATH,
- IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, IC_TFLITE_WEIGHT_MOBILENET_V2_224_PATH,
+ IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser,
+ _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "input";
inferenceBanana();
}
-TEST_P(TestImageClassification, CPU_TFLITE_Densenet)
+TEST_P(TestImageClassificationTflite, Densenet)
{
- engine_config_hosted_cpu_tflite_user_model(
- engine_cfg, IC_TFLITE_WEIGHT_DENSENET_224_PATH,
- IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, IC_TFLITE_WEIGHT_DENSENET_224_PATH,
+ IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser,
+ _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "Placeholder";
inferenceBanana();
}
-TEST_P(TestImageClassification, CPU_TFLITE_Nasnet)
+TEST_P(TestImageClassificationTflite, Nasnet)
{
- engine_config_hosted_cpu_tflite_user_model(engine_cfg,
- IC_TFLITE_WEIGHT_NASNET_224_PATH,
- IC_LABEL_MOBILENET_V1_224_PATH,
- _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, IC_TFLITE_WEIGHT_NASNET_224_PATH,
+ IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser,
+ _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "input";
inferenceBanana();
}
-TEST_P(TestImageClassification, CPU_TFLITE_MNasnet)
+TEST_P(TestImageClassificationTflite, MNasnet)
{
- engine_config_hosted_cpu_tflite_user_model(
- engine_cfg, IC_TFLITE_WEIGHT_MNASNET_224_PATH,
- IC_LABEL_MOBILENET_V1_224_PATH,
- _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, IC_TFLITE_WEIGHT_MNASNET_224_PATH,
+ IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser,
+ _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "input";
inferenceBanana();
}
-TEST_P(TestImageClassification, CPU_TFLITE_Squeezenet)
+TEST_P(TestImageClassificationTflite, Squeezenet)
{
- engine_config_hosted_cpu_tflite_user_model(
- engine_cfg, IC_TFLITE_WEIGHT_SQUEEZENET_224_PATH,
- IC_LABEL_MOBILENET_V1_224_PATH,
- _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, IC_TFLITE_WEIGHT_SQUEEZENET_224_PATH,
+ IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser,
+ _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "Placeholder";
inferenceBanana();
}
-TEST_P(TestImageClassification, CPU_TFLITE_QUANT_MobilenetV1)
+TEST_P(TestImageClassificationTflite, QUANT_MobilenetV1)
{
- engine_config_hosted_cpu_tflite_user_model(
- engine_cfg, IC_TFLITE_WEIGHT_QUANT_MOBILENET_V1_224_PATH,
- IC_LABEL_MOBILENET_V1_224_PATH,
- _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, IC_TFLITE_WEIGHT_QUANT_MOBILENET_V1_224_PATH,
+ IC_LABEL_MOBILENET_V1_224_PATH, _use_json_parser,
+ _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "input";
inferenceBanana();
}
-TEST_P(TestImageClassification, SNPE_InceptionV3_Quantized)
+TEST_P(TestImageClassificationSnpe, InceptionV3_Quantized)
{
- engine_config_hosted_cpu_snpe_user_model(
- engine_cfg, IC_SNPE_WEIGHT_QUANT_INCEPTION_V3_299_PATH,
- IC_LABEL_INCEPTION_V3_299_PATH,
- _use_json_parser);
+ engine_config_hosted_snpe_model(engine_cfg, IC_SNPE_WEIGHT_QUANT_INCEPTION_V3_299_PATH,
+ IC_LABEL_INCEPTION_V3_299_PATH, _use_json_parser,
+ _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "input";
inferenceBanana();
}
-INSTANTIATE_TEST_CASE_P(Prefix, TestImageClassification,
+INSTANTIATE_TEST_CASE_P(Prefix, TestImageClassificationTflite,
+ ::testing::Values(
+ ParamTypes(false, MV_INFERENCE_TARGET_DEVICE_CPU),
+ ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_CPU)
+ )
+);
+
+INSTANTIATE_TEST_CASE_P(Prefix, TestImageClassificationSnpe,
::testing::Values(
- ParamTypeOne(false),
- ParamTypeOne(true)
+ ParamTypes(false, MV_INFERENCE_TARGET_DEVICE_CPU),
+ ParamTypes(false, MV_INFERENCE_TARGET_DEVICE_GPU),
+ ParamTypes(false, MV_INFERENCE_TARGET_DEVICE_CUSTOM),
+ ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_CPU),
+ ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_GPU),
+ ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_CUSTOM)
)
);
\ No newline at end of file
EXPECT_EQ(mv_destroy_engine_config(engine_cfg), MEDIA_VISION_ERROR_NONE);
}
+void TestInference::ConfigureInference()
+{
+ ASSERT_EQ(mv_inference_configure(infer, engine_cfg),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_inference_prepare(infer), MEDIA_VISION_ERROR_NONE);
+}
+
void engine_config_hosted_model_config(mv_engine_config_h handle,
- const char *tf_weight,
- const bool use_json_parser)
+ const char *tf_weight,
+ const bool use_json_parser)
{
- EXPECT_EQ(mv_engine_config_set_string_attribute(
- handle, MV_INFERENCE_MODEL_WEIGHT_FILE_PATH, tf_weight),
+ EXPECT_EQ(mv_engine_config_set_string_attribute(handle, MV_INFERENCE_MODEL_WEIGHT_FILE_PATH, tf_weight),
MEDIA_VISION_ERROR_NONE);
if (use_json_parser) {
}
}
-void engine_config_hosted_cpu_tflite_user_model(mv_engine_config_h handle,
- const char *tf_weight,
- const char *user_file,
- const bool use_json_parser)
+void engine_config_hosted_tflite_model(mv_engine_config_h handle,
+ const char *tf_weight,
+ const char *user_file,
+ const bool use_json_parser,
+ const mv_inference_target_device_e target_device_type)
{
engine_config_hosted_model_config(handle, tf_weight, use_json_parser);
MEDIA_VISION_ERROR_NONE);
EXPECT_EQ(mv_engine_config_set_int_attribute(handle,
MV_INFERENCE_TARGET_DEVICE_TYPE,
- MV_INFERENCE_TARGET_DEVICE_CPU),
+ target_device_type),
MEDIA_VISION_ERROR_NONE);
- EXPECT_EQ(mv_engine_config_set_string_attribute(
- handle, MV_INFERENCE_MODEL_USER_FILE_PATH, user_file),
- MEDIA_VISION_ERROR_NONE);
+ if (user_file) {
+ EXPECT_EQ(mv_engine_config_set_string_attribute(handle, MV_INFERENCE_MODEL_USER_FILE_PATH, user_file),
+ MEDIA_VISION_ERROR_NONE);
+ }
}
-void engine_config_hosted_cpu_snpe_user_model(mv_engine_config_h handle,
- const char *tf_weight,
- const char *user_file,
- const bool use_json_parser)
+void engine_config_hosted_snpe_model(mv_engine_config_h handle,
+ const char *tf_weight,
+ const char *user_file,
+ const bool use_json_parser,
+ const mv_inference_target_device_e target_device_type)
{
engine_config_hosted_model_config(handle, tf_weight, use_json_parser);
MEDIA_VISION_ERROR_NONE);
EXPECT_EQ(mv_engine_config_set_int_attribute(handle,
MV_INFERENCE_TARGET_DEVICE_TYPE,
- MV_INFERENCE_TARGET_DEVICE_CPU),
+ target_device_type),
MEDIA_VISION_ERROR_NONE);
EXPECT_EQ(mv_engine_config_set_string_attribute(
handle, MV_INFERENCE_MODEL_USER_FILE_PATH, user_file),
MEDIA_VISION_ERROR_NONE);
-}
+}
\ No newline at end of file
#include <mv_inference.h>
-typedef std::tuple<int> ParamTypeOne;
+typedef std::tuple<bool, mv_inference_target_device_e> ParamTypes;
-class TestInference : public ::testing::TestWithParam<ParamTypeOne>
+class TestInference : public ::testing::TestWithParam<ParamTypes>
{
protected:
void SetUp() final
{
- std::tie(_use_json_parser) = GetParam();
+ std::tie(_use_json_parser, _target_device_type) = GetParam();
}
+ void ConfigureInference();
+
bool _use_json_parser;
+ mv_inference_target_device_e _target_device_type;
public:
TestInference();
};
void engine_config_hosted_model_config(mv_engine_config_h handle,
- const char *tf_weight,
- const bool use_json_parser);
+ const char *tf_weight,
+ const bool use_json_parser);
-void engine_config_hosted_cpu_tflite_user_model(mv_engine_config_h handle,
- const char *tf_weight,
- const char *user_file,
- const bool use_json_parser);
+void engine_config_hosted_tflite_model(mv_engine_config_h handle,
+ const char *tf_weight,
+ const char *user_file,
+ const bool use_json_parser,
+ const mv_inference_target_device_e target_device_type);
-void engine_config_hosted_cpu_snpe_user_model(mv_engine_config_h handle,
- const char *tf_weight,
- const char *user_file,
- const bool use_json_parser);
+void engine_config_hosted_snpe_model(mv_engine_config_h handle,
+ const char *tf_weight,
+ const char *user_file,
+ const bool use_json_parser,
+ const mv_inference_target_device_e target_device_type);
#endif //__TEST_INFERENCE_HELPER_HPP__
EXPECT_TRUE(answer_found);
}
-class TestObjectDetection : public TestInference
+class TestObjectDetectionTflite : public TestInference
{
public:
void inferenceDog()
{
- ASSERT_EQ(mv_inference_configure(infer, engine_cfg),
- MEDIA_VISION_ERROR_NONE);
- ASSERT_EQ(mv_inference_prepare(infer), MEDIA_VISION_ERROR_NONE);
+ TestInference::ConfigureInference();
+
ASSERT_EQ(MediaVision::Common::ImageHelper::loadImageToSource(
IMG_DOG, mv_source),
MEDIA_VISION_ERROR_NONE);
}
};
-TEST_P(TestObjectDetection, CPU_TFLITE_MobilenetV1_SSD)
+TEST_P(TestObjectDetectionTflite, MobilenetV1_SSD)
{
- engine_config_hosted_cpu_tflite_user_model(
- engine_cfg, OD_TFLITE_WEIGHT_MOBILENET_V1_SSD_300_PATH,
- OD_LABEL_MOBILENET_V1_SSD_300_PATH,
- _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, OD_TFLITE_WEIGHT_MOBILENET_V1_SSD_300_PATH,
+ OD_LABEL_MOBILENET_V1_SSD_300_PATH, _use_json_parser,
+ _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "normalized_input_image_tensor";
inferenceDog();
}
-INSTANTIATE_TEST_CASE_P(Prefix, TestObjectDetection,
+INSTANTIATE_TEST_CASE_P(Prefix, TestObjectDetectionTflite,
::testing::Values(
- ParamTypeOne(false),
- ParamTypeOne(true)
+ ParamTypes(false, MV_INFERENCE_TARGET_DEVICE_CPU),
+ ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_CPU)
)
);
\ No newline at end of file
ASSERT_EQ(cb_number_of_poses, 1);
}
-class TestPoseLandmarkDetection : public TestInference
+class TestPoseLandmarkDetectionTflite : public TestInference
{
public:
void inferencePoseLandmark()
{
- ASSERT_EQ(mv_inference_configure(infer, engine_cfg),
- MEDIA_VISION_ERROR_NONE);
- ASSERT_EQ(mv_inference_prepare(infer), MEDIA_VISION_ERROR_NONE);
+ TestInference::ConfigureInference();
+
ASSERT_EQ(MediaVision::Common::ImageHelper::loadImageToSource(
IMG_POSE_LANDMARK, mv_source),
MEDIA_VISION_ERROR_NONE);
}
};
-TEST_P(TestPoseLandmarkDetection, CPU_TFLITE_MobilenetV1)
+TEST_P(TestPoseLandmarkDetectionTflite, MobilenetV1)
{
- engine_config_hosted_model_config(
- engine_cfg, PLD_TFLITE_WEIGHT_MOBILENET_V1_POSENET_257_PATH, _use_json_parser);
+ engine_config_hosted_tflite_model(engine_cfg, PLD_TFLITE_WEIGHT_MOBILENET_V1_POSENET_257_PATH,
+ NULL, _use_json_parser, _target_device_type);
if (!_use_json_parser) {
const char *inputNodeName = "sub_2";
inferencePoseLandmark();
}
-INSTANTIATE_TEST_CASE_P(Prefix, TestPoseLandmarkDetection,
+INSTANTIATE_TEST_CASE_P(Prefix, TestPoseLandmarkDetectionTflite,
::testing::Values(
- ParamTypeOne(false),
- ParamTypeOne(true)
+ ParamTypes(false, MV_INFERENCE_TARGET_DEVICE_CPU),
+ ParamTypes(true, MV_INFERENCE_TARGET_DEVICE_CPU)
)
);
\ No newline at end of file