* @since_tizen 9.0
*
* @param[in] handle The handle to the face detection object.
- * @param[in] model_name Model name.
* @param[in] model_file Model file name.
* @param[in] meta_file Model meta file name.
* @param[in] label_file Label file name.
+ * @param[in] model_name Model name.
*
* @return @c 0 on success, otherwise a negative error value
* @retval #MEDIA_VISION_ERROR_NONE Successful
*
* @pre Create a face detection handle by calling @ref mv_face_detection_create()
*/
-int mv_face_detection_set_model(mv_face_detection_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file);
+int mv_face_detection_set_model(mv_face_detection_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name);
/**
* @internal
* @since_tizen 9.0
*
* @param[in] handle The handle to the facial landmark object.
- * @param[in] model_name Model name.
* @param[in] model_file Model file name.
* @param[in] meta_file Model meta file name.
* @param[in] label_file Label file name.
+ * @param[in] model_name Model name.
*
* @return @c 0 on success, otherwise a negative error value
* @retval #MEDIA_VISION_ERROR_NONE Successful
*
* @pre Create a facial landmark handle by calling @ref mv_facial_landmark_create()
*/
-int mv_facial_landmark_set_model(mv_facial_landmark_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file);
+int mv_facial_landmark_set_model(mv_facial_landmark_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name);
/**
* @internal
* @param[in] model_file Model file name.
* @param[in] meta_type Model meta file name.
* @param[in] label_file Label file name.
+ * @param[in] model_name Model name.
*
* @return @c 0 on success, otherwise a negative error value
* @retval #MEDIA_VISION_ERROR_NONE Successful
* @pre Create a image classification handle by calling @ref mv_image_classification_create()
*/
int mv_image_classification_set_model(mv_image_classification_h handle, const char *model_file, const char *meta_file,
- const char *label_file);
+ const char *label_file, const char *model_name);
/**
* @brief Set user-given inference engine and device types for inference.
* @since_tizen 9.0
*
* @param[in] handle The handle to the object detection 3d object.
- * @param[in] model_name Model name.
* @param[in] model_file Model file name.
* @param[in] meta_file Model meta file name.
* @param[in] label_file Label file name.
+ * @param[in] model_name Model name.
*
* @return @c 0 on success, otherwise a negative error value
* @retval #MEDIA_VISION_ERROR_NONE Successful
*
* @pre Create a object detection 3d handle by calling @ref mv_object_detection_3d_create()
*/
-int mv_object_detection_3d_set_model(mv_object_detection_3d_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file);
+int mv_object_detection_3d_set_model(mv_object_detection_3d_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name);
/**
* @brief Configures the backend for the object detection inference.
* @since_tizen 9.0
*
* @param[in] handle The handle to the object detection object.
- * @param[in] model_name Model name.
* @param[in] model_file Model file name.
* @param[in] meta_file Model meta file name.
* @param[in] label_file Label file name.
+ * @param[in] model_name Model name.
*
* @return @c 0 on success, otherwise a negative error value
* @retval #MEDIA_VISION_ERROR_NONE Successful
*
* @pre Create a object detection handle by calling @ref mv_object_detection_create()
*/
-int mv_object_detection_set_model(mv_object_detection_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file);
+int mv_object_detection_set_model(mv_object_detection_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name);
/**
* @internal
* @since_tizen 9.0
*
* @param[in] handle The handle to the pose landmark object.
- * @param[in] model_name Model name.
* @param[in] model_file Model file name.
* @param[in] meta_type Model meta file name.
* @param[in] label_file Label file name.
+ * @param[in] model_name Model name.
*
* @return @c 0 on success, otherwise a negative error value
* @retval #MEDIA_VISION_ERROR_NONE Successful
*
* @pre Create a pose landmark handle by calling @ref mv_pose_landmark_create()
*/
-int mv_pose_landmark_set_model(mv_pose_landmark_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file);
+int mv_pose_landmark_set_model(mv_pose_landmark_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name);
/**
* @brief Set user-given backend and device types for inference.
* @since_tizen 9.0
*
* @param[in] handle The handle to the selfie segmentation object.
- * @param[in] model_name Model name.
* @param[in] model_file Model file name.
* @param[in] meta_file Model meta file name.
* @param[in] label_file Label file name.
+ * @param[in] model_name Model name.
*
* @return @c 0 on success, otherwise a negative error value
* @retval #MEDIA_VISION_ERROR_NONE Successful
*
* @pre Create a selfie segmentation handle by calling @ref mv_selfie_segmentation_create()
*/
-int mv_selfie_segmentation_set_model(mv_selfie_segmentation_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file);
+int mv_selfie_segmentation_set_model(mv_selfie_segmentation_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name);
/**
* @internal
{
auto task = get_task(handle, task_name);
- task->setModelInfo(model_file, meta_file, label_file, model_name);
+ if (model_name)
+ task->setModelInfo(model_file, meta_file, label_file, model_name);
+ else
+ task->setModelInfo(model_file, meta_file, label_file);
}
void machine_learning_native_set_engine(void *handle, const string &task_name, const char *backend_type,
}
int mv_image_classification_set_model(mv_image_classification_h handle, const char *model_file, const char *meta_file,
- const char *label_file)
+ const char *label_file, const char *model_name)
{
MEDIA_VISION_SUPPORT_CHECK(mv_check_feature_key(feature_keys, num_keys, false));
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_FUNCTION_ENTER();
try {
- machine_learning_native_set_model(handle, TASK_NAME, model_file, meta_file, label_file);
+ machine_learning_native_set_model(handle, TASK_NAME, model_file, meta_file, label_file, model_name);
} catch (const BaseException &e) {
LOGE("%s", e.what());
return e.getError();
return MEDIA_VISION_ERROR_NONE;
}
-int mv_selfie_segmentation_set_model(mv_selfie_segmentation_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file)
+int mv_selfie_segmentation_set_model(mv_selfie_segmentation_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name)
{
MEDIA_VISION_SUPPORT_CHECK(mv_check_feature_key(feature_keys, num_keys, true));
MEDIA_VISION_FUNCTION_ENTER();
try {
- machine_learning_native_set_model(handle, TASK_NAME, model_file, meta_file, label_file);
+ machine_learning_native_set_model(handle, TASK_NAME, model_file, meta_file, label_file, model_name);
} catch (const BaseException &e) {
LOGE("%s", e.what());
return e.getError();
return MEDIA_VISION_ERROR_NONE;
}
-int mv_facial_landmark_set_model(mv_facial_landmark_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file)
+int mv_facial_landmark_set_model(mv_facial_landmark_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name)
{
MEDIA_VISION_SUPPORT_CHECK(mv_check_feature_key(feature_keys, num_keys, true));
MEDIA_VISION_INSTANCE_CHECK(handle);
- MEDIA_VISION_INSTANCE_CHECK(model_name);
MEDIA_VISION_NULL_ARG_CHECK(model_file);
MEDIA_VISION_NULL_ARG_CHECK(meta_file);
MEDIA_VISION_NULL_ARG_CHECK(label_file);
return MEDIA_VISION_ERROR_NONE;
}
-int mv_pose_landmark_set_model(mv_pose_landmark_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file)
+int mv_pose_landmark_set_model(mv_pose_landmark_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name)
{
MEDIA_VISION_SUPPORT_CHECK(mv_check_feature_key(feature_keys, num_keys, true));
MEDIA_VISION_INSTANCE_CHECK(handle);
- MEDIA_VISION_INSTANCE_CHECK(model_name);
MEDIA_VISION_NULL_ARG_CHECK(model_file);
MEDIA_VISION_NULL_ARG_CHECK(meta_file);
MEDIA_VISION_NULL_ARG_CHECK(label_file);
return MEDIA_VISION_ERROR_NONE;
}
-int mv_face_detection_set_model(mv_face_detection_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file)
+int mv_face_detection_set_model(mv_face_detection_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name)
{
MEDIA_VISION_SUPPORT_CHECK(mv_check_feature_key(feature_keys, num_keys, true));
MEDIA_VISION_INSTANCE_CHECK(handle);
- MEDIA_VISION_INSTANCE_CHECK(model_name);
MEDIA_VISION_NULL_ARG_CHECK(model_file);
MEDIA_VISION_NULL_ARG_CHECK(meta_file);
MEDIA_VISION_NULL_ARG_CHECK(label_file);
return MEDIA_VISION_ERROR_NONE;
}
-int mv_object_detection_set_model(mv_object_detection_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file)
+int mv_object_detection_set_model(mv_object_detection_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name)
{
MEDIA_VISION_SUPPORT_CHECK(mv_check_feature_key(feature_keys, num_keys, true));
return MEDIA_VISION_ERROR_NONE;
}
-int mv_object_detection_3d_set_model(mv_object_detection_3d_h handle, const char *model_name, const char *model_file,
- const char *meta_file, const char *label_file)
+int mv_object_detection_3d_set_model(mv_object_detection_3d_h handle, const char *model_file, const char *meta_file,
+ const char *label_file, const char *model_name)
{
lock_guard<mutex> lock(g_object_detection_3d_mutex);
MEDIA_VISION_SUPPORT_CHECK(mv_check_feature_key(feature_keys, num_keys, true));
MEDIA_VISION_INSTANCE_CHECK(handle);
- MEDIA_VISION_INSTANCE_CHECK(model_name);
MEDIA_VISION_NULL_ARG_CHECK(model_file);
MEDIA_VISION_NULL_ARG_CHECK(meta_file);
MEDIA_VISION_NULL_ARG_CHECK(label_file);
#include "gtest/gtest.h"
+#include "../task_model_info.hpp"
#include "ImageHelper.h"
#include "mv_image_classification.h"
#include "mv_image_classification_internal.h"
using namespace MediaVision::Common;
-struct model_info {
- string model_file;
- string meta_file;
- string label_file;
-};
-
TEST(ImageClassificationTest, GettingAvailableInferenceEnginesInfoShouldBeOk)
{
mv_image_classification_h handle;
{
mv_image_classification_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
{ "quant_mobilenet_v1_224x224.tflite", "quant_mobilenet_v1_224x224.json", "ic_mobilenet_v1_label.txt" },
{ "image-classification-001.tflite", "image-classification-001.json", "image-classification-label.txt" },
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_image_classification_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
- model.label_file.c_str());
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_image_classification_set_engine(handle, "tflite", "cpu");
#include "gtest/gtest.h"
+#include "../task_model_info.hpp"
#include "ImageHelper.h"
#include "mv_image_classification.h"
#include "mv_image_classification_internal.h"
using namespace MediaVision::Common;
-struct model_info {
- string model_file;
- string meta_file;
- string label_file;
- mv_source_h source;
-};
-
void image_classification_callback(void *user_data)
{
mv_image_classification_h handle = static_cast<mv_image_classification_h>(user_data);
TEST(ImageClassificationAsyncTest, InferenceShouldBeOk)
{
mv_image_classification_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
{ "quant_mobilenet_v1_224x224.tflite", "quant_mobilenet_v1_224x224.json", "ic_mobilenet_v1_label.txt" },
{ "image-classification-001.tflite", "image-classification-001.json", "image-classification-label.txt" },
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_image_classification_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
- model.label_file.c_str());
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_image_classification_set_engine(handle, "tflite", "cpu");
ret = ImageHelper::loadImageToSource(IMAGE_PATH, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- model.source = mv_source;
-
ret = mv_image_classification_inference_async(handle, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
TEST(ImageClassificationAsyncTest, InferenceShouldBeOkWithDestroyFirst)
{
mv_image_classification_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
{ "quant_mobilenet_v1_224x224.tflite", "quant_mobilenet_v1_224x224.json", "ic_mobilenet_v1_label.txt" },
{ "image-classification-001.tflite", "image-classification-001.json", "image-classification-label.txt" },
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_image_classification_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
- model.label_file.c_str());
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_image_classification_set_engine(handle, "tflite", "cpu");
ret = ImageHelper::loadImageToSource(IMAGE_PATH, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- model.source = mv_source;
-
ret = mv_image_classification_inference_async(handle, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
#include "gtest/gtest.h"
+#include "../task_model_info.hpp"
#include "ImageHelper.h"
#include "mv_selfie_segmentation_internal.h"
using namespace std;
using namespace MediaVision::Common;
-struct model_info {
- string model_name;
- string model_file;
- string meta_file;
- string label_file;
-};
-
// Copied from https://docs.opencv.org/4.x/d5/dc4/tutorial_video_input_psnr_ssim.html
cv::Scalar getMSSIM(const cv::Mat &i1, const cv::Mat &i2)
{
TEST(ImageSegmentationTest, DISABLED_InferenceShouldBeOk)
{
mv_selfie_segmentation_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{ "", "", "", "" } // If empty then default model will be used.
// TODO.
};
ret = mv_selfie_segmentation_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_selfie_segmentation_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_selfie_segmentation_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_selfie_segmentation_set_engine(handle, "tflite", "cpu");
#include "gtest/gtest.h"
+#include "../task_model_info.hpp"
#include "ImageHelper.h"
#include "mv_facial_landmark.h"
#include "mv_facial_landmark_internal.h"
using namespace MediaVision::Common;
-struct model_info {
- string model_name;
- string model_file;
- string meta_file;
- string label_file;
-};
-
TEST(FacialLandmarkTest, GettingAvailableInferenceEnginesInfoShouldBeOk)
{
mv_facial_landmark_h handle;
TEST(FacialLandmarkTest, InferenceShouldBeOk)
{
mv_facial_landmark_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
- { "FLD_TWEAK_CNN", "fld_tweakcnn_128x128.tflite", "fld_tweakcnn_128x128.json", "" }
+ { "fld_tweakcnn_128x128.tflite", "fld_tweakcnn_128x128.json", "", "FLD_TWEAK_CNN" }
// TODO.
};
ret = mv_facial_landmark_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_facial_landmark_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_facial_landmark_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), model.model_name.c_str());
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_facial_landmark_set_engine(handle, "tflite", "cpu");
TEST(PoseLandmarkTest, InferenceShouldBeOk)
{
mv_pose_landmark_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
- { "PLD_CPM", "pld_cpm_192x192.tflite", "pld_cpm_192x192.json", "" }
+ { "pld_cpm_192x192.tflite", "pld_cpm_192x192.json", "", "PLD_CPM" }
// TODO.
};
const unsigned int coordinate_answers[][10] = { { 300, 300, 275, 250, 325, 325, 225, 225, 350, 375 },
ret = mv_pose_landmark_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_pose_landmark_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_pose_landmark_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), model.model_name.c_str());
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_pose_landmark_set_engine(handle, "tflite", "cpu");
#include "gtest/gtest.h"
+#include "../task_model_info.hpp"
#include "ImageHelper.h"
#include "mv_facial_landmark.h"
#include "mv_facial_landmark_internal.h"
using namespace MediaVision::Common;
-struct model_info {
- string model_name;
- string model_file;
- string meta_file;
- string label_file;
-};
-
void pose_landmark_callback(void *user_data)
{
mv_pose_landmark_h handle = static_cast<mv_pose_landmark_h>(user_data);
TEST(PoseLandmarkAsyncTest, InferenceShouldBeOk)
{
mv_pose_landmark_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
- { "PLD_CPM", "pld_cpm_192x192.tflite", "pld_cpm_192x192.json", "" }
+ { "pld_cpm_192x192.tflite", "pld_cpm_192x192.json", "", "PLD_CPM" }
// TODO.
};
int ret = mv_pose_landmark_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_pose_landmark_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_pose_landmark_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), model.model_name.c_str());
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_pose_landmark_set_engine(handle, "tflite", "cpu");
TEST(PoseLandmarkAsyncTest, InferenceShouldBeOkWithDestroyFirst)
{
mv_pose_landmark_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
- { "PLD_CPM", "pld_cpm_192x192.tflite", "pld_cpm_192x192.json", "" }
+ { "pld_cpm_192x192.tflite", "pld_cpm_192x192.json", "", "PLD_CPM" }
// TODO.
};
int ret = mv_pose_landmark_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_pose_landmark_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_pose_landmark_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), model.model_name.c_str());
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_pose_landmark_set_engine(handle, "tflite", "cpu");
TEST(FacialLandmarkAsyncTest, InferenceShouldBeOk)
{
mv_facial_landmark_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
- { "FLD_TWEAK_CNN", "fld_tweakcnn_128x128.tflite", "fld_tweakcnn_128x128.json", "" }
+ { "fld_tweakcnn_128x128.tflite", "fld_tweakcnn_128x128.json", "", "FLD_TWEAK_CNN" }
// TODO.
};
int ret = mv_facial_landmark_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_facial_landmark_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_facial_landmark_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), model.model_name.c_str());
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_facial_landmark_set_engine(handle, "tflite", "cpu");
TEST(FacialLandmarkAsyncTest, InferenceShouldBeOkWithDestroyFirst)
{
mv_facial_landmark_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{ "", "", "", "" }, // If empty then default model will be used.
- { "FLD_TWEAK_CNN", "fld_tweakcnn_128x128.tflite", "fld_tweakcnn_128x128.json", "" }
+ { "fld_tweakcnn_128x128.tflite", "fld_tweakcnn_128x128.json", "", "FLD_TWEAK_CNN" }
// TODO.
};
int ret = mv_facial_landmark_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_facial_landmark_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_facial_landmark_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), model.model_name.c_str());
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_facial_landmark_set_engine(handle, "tflite", "cpu");
#include "gtest/gtest.h"
+#include "../task_model_info.hpp"
#include "ImageHelper.h"
#include "mv_face_detection.h"
#include "mv_face_detection_internal.h"
using namespace MediaVision::Common;
-struct model_info {
- string model_name;
- string model_file;
- string meta_file;
- string label_file;
-};
-
TEST(ObjectDetectionTest, GettingAvailableInferenceEnginesInfoShouldBeOk)
{
mv_object_detection_h handle;
TEST(ObjectDetectionTest, InferenceShouldBeOk)
{
mv_object_detection_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
{ "mobilenet_v1_ssd", "od_mobilenet_v1_ssd_postop_300x300.tflite", "od_mobilenet_v1_ssd_postop_300x300.json",
"od_mobilenet_v1_ssd_postop_label.txt" },
ret = mv_object_detection_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_object_detection_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_object_detection_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_object_detection_set_engine(handle, "tflite", "cpu");
TEST(FaceDetectionTest, InferenceShouldBeOk)
{
mv_object_detection_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
{ "fd_mobilenet_v1_ssd", "fd_mobilenet_v1_ssd_postop_300x300.tflite", "fd_mobilenet_v1_ssd_postop_300x300.json",
"fd_mobilenet_v1_ssd_postop_label.txt" }
ret = mv_face_detection_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_face_detection_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_face_detection_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_face_detection_set_engine(handle, "tflite", "cpu");
#include "gtest/gtest.h"
+#include "../task_model_info.hpp"
#include "ImageHelper.h"
#include "mv_face_detection.h"
#include "mv_face_detection_internal.h"
using namespace MediaVision::Common;
-struct model_info {
- string model_name;
- string model_file;
- string meta_file;
- string label_file;
- mv_source_h source;
-};
-
void object_detection_callback(void *user_data)
{
mv_object_detection_h handle = static_cast<mv_object_detection_h>(user_data);
TEST(ObjectDetectionAsyncTest, InferenceShouldBeOk)
{
mv_object_detection_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{} // If empty then default model will be used.
};
int ret = mv_object_detection_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_object_detection_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_object_detection_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_object_detection_set_engine(handle, "tflite", "cpu");
ret = ImageHelper::loadImageToSource(IMG_DOG, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- model.source = mv_source;
-
ret = mv_object_detection_inference_async(handle, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
TEST(ObjectDetectionAsyncTest, InferenceShouldBeOkWithDestroyFirst)
{
mv_object_detection_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{} // If empty then default model will be used.
};
int ret = mv_object_detection_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_object_detection_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_object_detection_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_object_detection_set_engine(handle, "tflite", "cpu");
ret = ImageHelper::loadImageToSource(IMG_DOG, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- model.source = mv_source;
-
ret = mv_object_detection_inference_async(handle, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
TEST(FaceDetectionAsyncTest, InferenceShouldBeOk)
{
mv_object_detection_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{} // If empty then default model will be used.
// TODO.
};
int ret = mv_face_detection_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_face_detection_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_face_detection_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_face_detection_set_engine(handle, "tflite", "cpu");
ret = ImageHelper::loadImageToSource(IMG_FACE, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- model.source = mv_source;
-
ret = mv_face_detection_inference_async(handle, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
TEST(FaceDetectionAsyncTest, InferenceShouldBeOkWithDestroyFirst)
{
mv_object_detection_h handle;
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{} // If empty then default model will be used.
// TODO.
};
int ret = mv_face_detection_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_face_detection_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_face_detection_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_face_detection_set_engine(handle, "tflite", "cpu");
ret = ImageHelper::loadImageToSource(IMG_FACE, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- model.source = mv_source;
-
ret = mv_face_detection_inference_async(handle, mv_source);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
#include "gtest/gtest.h"
+#include "../task_model_info.hpp"
#include "ImageHelper.h"
#include "mv_object_detection_3d_internal.h"
using namespace MediaVision::Common;
-struct model_info {
- string model_name;
- string model_file;
- string meta_file;
- string label_file;
-};
-
TEST(ObjectDetection3dTest, GettingAvailableInferenceEnginesInfoShouldBeOk)
{
mv_object_detection_3d_h handle;
TEST(ObjectDetection3dTest, InferenceShouldBeOk)
{
- vector<model_info> test_models {
+ vector<test_model_input> test_models {
{}, // If empty then default model will be used.
{ "objectron", "object_detection_3d_cup.tflite", "object_detection_3d_cup.json", "" }
// TODO.
ret = mv_object_detection_3d_create(&handle);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
- ret = mv_object_detection_3d_set_model(handle, model.model_name.c_str(), model.model_file.c_str(),
- model.meta_file.c_str(), model.label_file.c_str());
+ ret = mv_object_detection_3d_set_model(handle, model.model_file.c_str(), model.meta_file.c_str(),
+ model.label_file.c_str(), NULL);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
ret = mv_object_detection_3d_set_engine(handle, "tflite", "cpu");
--- /dev/null
+#ifndef __TASK_MODEL_INFO_HPP__
+#define __TASK_MODEL_INFO_HPP__
+
+#include <mv_common.h>
+#include <string>
+
+struct test_model_input {
+ std::string model_file;
+ std::string meta_file;
+ std::string label_file;
+ std::string model_name;
+};
+
+#endif // __TASK_MODEL_INFO_HPP__