mv_machine_learning: pass a task type to external module
authorInki Dae <inki.dae@samsung.com>
Thu, 27 Jul 2023 05:44:07 +0000 (14:44 +0900)
committerKwanghoon Son <k.son@samsung.com>
Mon, 7 Aug 2023 04:25:06 +0000 (13:25 +0900)
[Issue type] : code cleanup

Pass a given task type from Mediavision framework to external module
so that the external module can perform various models according to
user-given behavior.

Change-Id: I86f3254081c4bf47d3659c97ee20a4a0c5408843
Signed-off-by: Inki Dae <inki.dae@samsung.com>
mv_machine_learning/object_detection/src/object_detection_adapter.cpp
mv_machine_learning/object_detection/src/object_detection_external.cpp

index 27feb9c..6165c4a 100644 (file)
@@ -54,7 +54,7 @@ template<typename T, typename V> void ObjectDetectionAdapter<T, V>::create(int t
                _object_detection = make_unique<MobilenetV1Ssd>(task_type);
        else if (task_type == ObjectDetectionTaskType::MOBILENET_V2_SSD)
                _object_detection = make_unique<MobilenetV2Ssd>(task_type);
-       else if (task_type == ObjectDetectionTaskType::OD_PLUGIN)
+       else if (task_type == ObjectDetectionTaskType::OD_PLUGIN || task_type == ObjectDetectionTaskType::FD_PLUGIN)
                _object_detection = make_unique<ObjectDetectionExternal>(task_type);
        // TODO.
 }
@@ -70,8 +70,11 @@ void ObjectDetectionAdapter<T, V>::setModelInfo(const char *model_file, const ch
 
                int model_type = 0;
 
-               if (model_name_str == "OD_PLUGIN") {
-                       model_type = static_cast<int>(ObjectDetectionTaskType::OD_PLUGIN);
+               if (model_name_str == "OD_PLUGIN" || model_name_str == "FD_PLUGIN") {
+                       if (model_name_str == "OD_PLUGIN")
+                               model_type = static_cast<int>(ObjectDetectionTaskType::OD_PLUGIN);
+                       if (model_name_str == "FD_PLUGIN")
+                               model_type = static_cast<int>(ObjectDetectionTaskType::FD_PLUGIN);
 
                        // In case of using plugin module, model information will be managed by the plugin module.
                        // Therefore, create plugin instance now.
index e19a331..f230412 100644 (file)
@@ -29,7 +29,7 @@ namespace mediavision
 {
 namespace machine_learning
 {
-typedef IObjectDetection *create_t(void);
+typedef IObjectDetection *create_t(ObjectDetectionTaskType task_type);
 typedef void destroy_t(IObjectDetection *);
 
 ObjectDetectionExternal::ObjectDetectionExternal(ObjectDetectionTaskType task_type)
@@ -52,7 +52,7 @@ ObjectDetectionExternal::ObjectDetectionExternal(ObjectDetectionTaskType task_ty
                throw InvalidOperation("Fail to get symbol from plugin library.");
        }
 
-       _object_detection_plugin = createPlugin();
+       _object_detection_plugin = createPlugin(task_type);
        if (_object_detection_plugin == NULL) {
                dlclose(_plugin_handle);
                _plugin_handle = NULL;