int mv_object_detection_create(mv_object_detection_h *handle)
{
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_check_system_info_feature_supported());
MEDIA_VISION_NULL_ARG_CHECK(handle);
MEDIA_VISION_FUNCTION_ENTER();
int mv_object_detection_destroy(mv_object_detection_h handle)
{
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_FUNCTION_ENTER();
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_NULL_ARG_CHECK(backend_type);
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_NULL_ARG_CHECK(engine_count);
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_NULL_ARG_CHECK(engine_type);
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_NULL_ARG_CHECK(device_count);
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_NULL_ARG_CHECK(engine_type);
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_FUNCTION_ENTER();
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_FUNCTION_ENTER();
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_image_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_image_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_INSTANCE_CHECK(source);
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_image_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_image_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_INSTANCE_CHECK(source);
MEDIA_VISION_INSTANCE_CHECK(completion_cb);
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_image_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_image_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_INSTANCE_CHECK(number_of_objects);
MEDIA_VISION_INSTANCE_CHECK(indices);
{
lock_guard<mutex> lock(g_object_detection_mutex);
- MEDIA_VISION_SUPPORT_CHECK(_mv_inference_image_check_system_info_feature_supported());
+ //MEDIA_VISION_SUPPORT_CHECK(_mv_inference_image_check_system_info_feature_supported());
MEDIA_VISION_INSTANCE_CHECK(handle);
MEDIA_VISION_INSTANCE_CHECK(label);
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
}
+TEST(NVisionObjectDetectionTest, InferenceShouldBeOk)
+{
+ mv_object_detection_h handle;
+ vector<string> test_model_names = { "OD_PLUGIN", "FD_PLUGIN" };
+
+ mv_source_h mv_source = NULL;
+ int ret = mv_create_source(&mv_source);
+ ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
+
+ ret = ImageHelper::loadImageToSource(IMG_DOG, mv_source);
+ ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
+
+ for (auto &model_name : test_model_names) {
+ ret = mv_object_detection_create(&handle);
+ ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
+
+ mv_object_detection_set_model(handle, model_name.c_str(), NULL, NULL, NULL);
+
+ ret = mv_object_detection_configure(handle);
+ ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
+
+ ret = mv_object_detection_prepare(handle);
+ ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
+
+ ret = mv_object_detection_inference(handle, mv_source);
+ ASSERT_EQ(ret, 0);
+
+ unsigned int number_of_objects;
+ const int *left, *top, *right, *bottom;
+ const unsigned int *indices;
+ const float *confidences;
+
+ ret = mv_object_detection_get_result(handle, &number_of_objects, &indices, &confidences, &left, &top, &right,
+ &bottom);
+ ASSERT_EQ(ret, 0);
+
+ for (unsigned int idx = 0; idx < number_of_objects; ++idx) {
+ cout << "index = " << indices[idx] << " probability = " << confidences[idx] << " " << left[idx] << " x "
+ << top[idx] << " ~ " << right[idx] << " x " << bottom[idx] << endl;
+ }
+
+ for (unsigned int idx = 0; idx < number_of_objects; ++idx) {
+ const char *label;
+
+ ret = mv_object_detection_get_label(handle, indices[idx], &label);
+ ASSERT_EQ(ret, 0);
+ cout << "index = " << indices[idx] << " label = " << label << endl;
+ }
+
+ ret = mv_object_detection_destroy(handle);
+ ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
+ }
+
+ ret = mv_destroy_source(mv_source);
+ ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
+}
+
TEST(FaceDetectionTest, InferenceShouldBeOk)
{
mv_object_detection_h handle;