rename InferenceServiceInterface to InferenceTaskInterface 95/311195/4
authorInki Dae <inki.dae@samsung.com>
Thu, 16 May 2024 03:09:13 +0000 (12:09 +0900)
committerInki Dae <inki.dae@samsung.com>
Thu, 16 May 2024 10:43:43 +0000 (19:43 +0900)
Rename InferenceServiceInterface to InferenceTaskInterface including
relevant code as we discussed before. The use of *service* terms made us
confusing specific service such as Autozoom.

Change-Id: Ibfcb51f333a7bbdb87c577edd5bcdd8cc6cceb0e
Signed-off-by: Inki Dae <inki.dae@samsung.com>
21 files changed:
inference/backends/mediavision/CMakeLists.txt
inference/backends/mediavision/include/MvFaceDetection.h
inference/backends/mediavision/include/MvFaceLandmark.h
inference/backends/mediavision/include/MvInferenceServiceFactory.h [deleted file]
inference/backends/mediavision/include/MvInferenceTaskFactory.h [new file with mode: 0644]
inference/backends/mediavision/include/MvObjectDetection.h
inference/backends/mediavision/src/MvInferenceServiceFactory.cpp [deleted file]
inference/backends/mediavision/src/MvInferenceTaskFactory.cpp [new file with mode: 0644]
inference/include/IInferenceServiceFactory.h [deleted file]
inference/include/IInferenceServiceInterface.h [deleted file]
inference/include/IInferenceTaskFactory.h [new file with mode: 0644]
inference/include/IInferenceTaskInterface.h [new file with mode: 0644]
inference/include/InferenceServiceFactory.h [deleted file]
inference/include/InferenceTaskFactory.h [new file with mode: 0644]
services/auto_zoom/src/AutoZoom.cpp
services/task_manager/include/INode.h
services/task_manager/include/InferenceNode.h
services/task_manager/include/TaskManager.h
services/task_manager/src/InferenceNode.cpp
services/task_manager/src/TaskManager.cpp
test/services/test_task_manager.cpp

index c630fb096ff2a89ab3103f4b4bb072a3d5321393..dfea22dcfacba025aac4ffe5681e6907f0b7a5c3 100644 (file)
@@ -10,7 +10,7 @@ SET(SINGLEO_SERVICE_SOURCE_FILES
     ${INFERENCE_MEDIAVISION_BACKEND_DIRECTORY}/src/MvFaceDetection.cpp
     ${INFERENCE_MEDIAVISION_BACKEND_DIRECTORY}/src/MvFaceLandmark.cpp
     ${INFERENCE_MEDIAVISION_BACKEND_DIRECTORY}/src/MvObjectDetection.cpp
-       ${INFERENCE_MEDIAVISION_BACKEND_DIRECTORY}/src/MvInferenceServiceFactory.cpp
+       ${INFERENCE_MEDIAVISION_BACKEND_DIRECTORY}/src/MvInferenceTaskFactory.cpp
 )
 
 LIST(APPEND INFERENCE_LIBRARY_LIST ${INFERENCE_LIBRARY_LIST} mv_common mv_inference mv_object_detection mv_landmark_detection)
index 2379b2988c60a84b8a9066d04bb043bb16456eaf..c09922a8210e0ba20350bb050a2dd5fb6eff00b8 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __FACE_DETECTION_H__
-#define __FACE_DETECTION_H__
+#ifndef __MV_FACE_DETECTION_H__
+#define __MV_FACE_DETECTION_H__
 
-#include "IInferenceServiceInterface.h"
+#include "IInferenceTaskInterface.h"
 #include "mv_face_detection_internal.h"
 #include "SingleoCommonTypes.h"
 
@@ -27,7 +27,7 @@ namespace inference
 {
 namespace backends
 {
-class MvFaceDetection : public IInferenceServiceInterface
+class MvFaceDetection : public IInferenceTaskInterface
 {
 private:
        mv_face_detection_h _handle {};
index e70f3e5bc3ea44549329fd9032385a7aa3c6dd0a..873f8d66fc5374e7495d4e9657afcfc26e6fa042 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __MV_FACE_LANDMARK_H__
 #define __MV_FACE_LANDMARK_H__
 
-#include "IInferenceServiceInterface.h"
+#include "IInferenceTaskInterface.h"
 #include "mv_facial_landmark_internal.h"
 #include "SingleoCommonTypes.h"
 
@@ -27,7 +27,7 @@ namespace inference
 {
 namespace backends
 {
-class MvFaceLandmark : public IInferenceServiceInterface
+class MvFaceLandmark : public IInferenceTaskInterface
 {
 private:
        mv_facial_landmark_h _handle {};
diff --git a/inference/backends/mediavision/include/MvInferenceServiceFactory.h b/inference/backends/mediavision/include/MvInferenceServiceFactory.h
deleted file mode 100644 (file)
index 351203e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __MV_INFERENCE_SERVICE_FACTORY_H__
-#define __MV_INFERENCE_SERVICE_FACTORY_H__
-
-#include "IInferenceServiceFactory.h"
-
-namespace singleo
-{
-namespace inference
-{
-class MvInferenceServiceFactory : public IInferenceServiceFactory
-{
-private:
-       static bool _registered;
-
-public:
-       MvInferenceServiceFactory() = default;
-       virtual ~MvInferenceServiceFactory() = default;
-
-       std::unique_ptr<IInferenceServiceInterface> createImageClassification() override;
-       std::unique_ptr<IInferenceServiceInterface> createObjectDetection() override;
-       std::unique_ptr<IInferenceServiceInterface> createFaceDetection() override;
-       std::unique_ptr<IInferenceServiceInterface> createFaceLandmarkDetection() override;
-};
-
-}
-}
-
-#endif
diff --git a/inference/backends/mediavision/include/MvInferenceTaskFactory.h b/inference/backends/mediavision/include/MvInferenceTaskFactory.h
new file mode 100644 (file)
index 0000000..a879b24
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MV_INFERENCE_TASK_FACTORY_H__
+#define __MV_INFERENCE_TASK_FACTORY_H__
+
+#include "IInferenceTaskFactory.h"
+
+namespace singleo
+{
+namespace inference
+{
+class MvInferenceTaskFactory : public IInferenceTaskFactory
+{
+private:
+       static bool _registered;
+
+public:
+       MvInferenceTaskFactory() = default;
+       virtual ~MvInferenceTaskFactory() = default;
+
+       std::unique_ptr<IInferenceTaskInterface> createImageClassification() override;
+       std::unique_ptr<IInferenceTaskInterface> createObjectDetection() override;
+       std::unique_ptr<IInferenceTaskInterface> createFaceDetection() override;
+       std::unique_ptr<IInferenceTaskInterface> createFaceLandmarkDetection() override;
+};
+
+}
+}
+
+#endif
index 9c8a97f4844857786e45f2a711cd086eecf0e763..74e5262ecfffa09ea246e75088ede4167993df26 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __OBJECT_DETECTION_H__
-#define __OBJECT_DETECTION_H__
+#ifndef __MV_OBJECT_DETECTION_H__
+#define __MV_OBJECT_DETECTION_H__
 
-#include "IInferenceServiceInterface.h"
+#include "IInferenceTaskInterface.h"
 #include "mv_object_detection_internal.h"
 #include "SingleoCommonTypes.h"
 
@@ -27,7 +27,7 @@ namespace inference
 {
 namespace backends
 {
-class MvObjectDetection : public IInferenceServiceInterface
+class MvObjectDetection : public IInferenceTaskInterface
 {
 private:
        mv_object_detection_h _handle {};
diff --git a/inference/backends/mediavision/src/MvInferenceServiceFactory.cpp b/inference/backends/mediavision/src/MvInferenceServiceFactory.cpp
deleted file mode 100644 (file)
index c35e1d9..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "InferenceServiceFactory.h"
-#include "MvInferenceServiceFactory.h"
-#include "MvFaceDetection.h"
-#include "MvFaceLandmark.h"
-#include "MvObjectDetection.h"
-#include "SingleoLog.h"
-#include "SingleoException.h"
-
-using namespace std;
-using namespace singleo::exception;
-using namespace singleo::inference::backends;
-
-namespace singleo
-{
-namespace inference
-{
-bool MvInferenceServiceFactory::_registered =
-               registerInferenceServiceFactory<MvInferenceServiceFactory>("MvInferenceServiceFactory");
-
-std::unique_ptr<IInferenceServiceInterface> MvInferenceServiceFactory::createImageClassification()
-{
-       throw InvalidOperation("Interface not supported yet.");
-}
-
-std::unique_ptr<IInferenceServiceInterface> MvInferenceServiceFactory::createObjectDetection()
-{
-       return make_unique<MvObjectDetection>();
-}
-
-std::unique_ptr<IInferenceServiceInterface> MvInferenceServiceFactory::createFaceDetection()
-{
-       return make_unique<MvFaceDetection>();
-}
-
-std::unique_ptr<IInferenceServiceInterface> MvInferenceServiceFactory::createFaceLandmarkDetection()
-{
-       return make_unique<MvFaceLandmark>();
-}
-
-}
-}
diff --git a/inference/backends/mediavision/src/MvInferenceTaskFactory.cpp b/inference/backends/mediavision/src/MvInferenceTaskFactory.cpp
new file mode 100644 (file)
index 0000000..3f147a5
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "InferenceTaskFactory.h"
+#include "MvInferenceTaskFactory.h"
+#include "MvFaceDetection.h"
+#include "MvFaceLandmark.h"
+#include "MvObjectDetection.h"
+#include "SingleoLog.h"
+#include "SingleoException.h"
+
+using namespace std;
+using namespace singleo::exception;
+using namespace singleo::inference::backends;
+
+namespace singleo
+{
+namespace inference
+{
+bool MvInferenceTaskFactory::_registered =
+               registerInferenceTaskFactory<MvInferenceTaskFactory>("MvInferenceTaskFactory");
+
+std::unique_ptr<IInferenceTaskInterface> MvInferenceTaskFactory::createImageClassification()
+{
+       throw InvalidOperation("Interface not supported yet.");
+}
+
+std::unique_ptr<IInferenceTaskInterface> MvInferenceTaskFactory::createObjectDetection()
+{
+       return make_unique<MvObjectDetection>();
+}
+
+std::unique_ptr<IInferenceTaskInterface> MvInferenceTaskFactory::createFaceDetection()
+{
+       return make_unique<MvFaceDetection>();
+}
+
+std::unique_ptr<IInferenceTaskInterface> MvInferenceTaskFactory::createFaceLandmarkDetection()
+{
+       return make_unique<MvFaceLandmark>();
+}
+
+}
+}
diff --git a/inference/include/IInferenceServiceFactory.h b/inference/include/IInferenceServiceFactory.h
deleted file mode 100644 (file)
index 7f0ffb8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __IINFERENCE_SERVICE_FACTORY_H__
-#define __IINFERENCE_SERVICE_FACTORY_H__
-
-#include <memory>
-
-#include "IInferenceServiceInterface.h"
-
-namespace singleo
-{
-namespace inference
-{
-class IInferenceServiceFactory
-{
-public:
-       virtual ~IInferenceServiceFactory() {};
-
-       virtual std::unique_ptr<IInferenceServiceInterface> createImageClassification() = 0;
-       virtual std::unique_ptr<IInferenceServiceInterface> createObjectDetection() = 0;
-       virtual std::unique_ptr<IInferenceServiceInterface> createFaceDetection() = 0;
-       virtual std::unique_ptr<IInferenceServiceInterface> createFaceLandmarkDetection() = 0;
-};
-
-}
-}
-
-#endif
\ No newline at end of file
diff --git a/inference/include/IInferenceServiceInterface.h b/inference/include/IInferenceServiceInterface.h
deleted file mode 100644 (file)
index f412288..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __IINFERENCE_SERVICE_INTERFACE_H__
-#define __IINFERENCE_SERVICE_INTERFACE_H__
-
-#include "SingleoInferenceTypes.h"
-#include "SingleoCommonTypes.h"
-
-namespace singleo
-{
-namespace inference
-{
-class IInferenceServiceInterface
-{
-public:
-       virtual ~IInferenceServiceInterface() {};
-
-       virtual void configure() = 0;
-       virtual void prepare() = 0;
-       virtual void invoke(BaseDataType &input, bool async = false) = 0;
-       virtual BaseResultType &result() = 0;
-};
-
-} // inference
-} // singleo
-
-#endif
\ No newline at end of file
diff --git a/inference/include/IInferenceTaskFactory.h b/inference/include/IInferenceTaskFactory.h
new file mode 100644 (file)
index 0000000..f88064b
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __IINFERENCE_TASK_FACTORY_H__
+#define __IINFERENCE_TASK_FACTORY_H__
+
+#include <memory>
+
+#include "IInferenceTaskInterface.h"
+
+namespace singleo
+{
+namespace inference
+{
+class IInferenceTaskFactory
+{
+public:
+       virtual ~IInferenceTaskFactory() {};
+
+       virtual std::unique_ptr<IInferenceTaskInterface> createImageClassification() = 0;
+       virtual std::unique_ptr<IInferenceTaskInterface> createObjectDetection() = 0;
+       virtual std::unique_ptr<IInferenceTaskInterface> createFaceDetection() = 0;
+       virtual std::unique_ptr<IInferenceTaskInterface> createFaceLandmarkDetection() = 0;
+};
+
+}
+}
+
+#endif
\ No newline at end of file
diff --git a/inference/include/IInferenceTaskInterface.h b/inference/include/IInferenceTaskInterface.h
new file mode 100644 (file)
index 0000000..f7dd3b4
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __IINFERENCE_TASK_INTERFACE_H__
+#define __IINFERENCE_TASK_INTERFACE_H__
+
+#include "SingleoInferenceTypes.h"
+#include "SingleoCommonTypes.h"
+
+namespace singleo
+{
+namespace inference
+{
+class IInferenceTaskInterface
+{
+public:
+       virtual ~IInferenceTaskInterface() {};
+
+       virtual void configure() = 0;
+       virtual void prepare() = 0;
+       virtual void invoke(BaseDataType &input, bool async = false) = 0;
+       virtual BaseResultType &result() = 0;
+};
+
+} // inference
+} // singleo
+
+#endif
\ No newline at end of file
diff --git a/inference/include/InferenceServiceFactory.h b/inference/include/InferenceServiceFactory.h
deleted file mode 100644 (file)
index 7011d1a..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __INFERENCE_SERVICE_FACTORY_H__
-#define __INFERENCE_SERVICE_FACTORY_H__
-
-#include <unordered_map>
-#include <vector>
-#include <string>
-#include <memory>
-#include <stdexcept>
-#include "IInferenceServiceFactory.h"
-#include "SingleoException.h"
-#include "SingleoLog.h"
-
-namespace singleo
-{
-namespace inference
-{
-class InferenceServiceFactory
-{
-public:
-       using createFunc = std::unique_ptr<IInferenceServiceFactory> (*)();
-
-       static InferenceServiceFactory &instance()
-       {
-               static InferenceServiceFactory factory;
-               return factory;
-       }
-
-       std::unique_ptr<IInferenceServiceFactory> create(const std::string &name)
-       {
-               auto it = _inference_service_table.find(name);
-               if (it != _inference_service_table.end())
-                       return it->second();
-
-               throw singleo::exception::InvalidParameter("Invalid inference service factory.");
-       }
-
-       void registerBackend(const std::string &name, const createFunc &func)
-       {
-               _inference_service_table[name] = func;
-       }
-
-private:
-       InferenceServiceFactory() = default;
-       ~InferenceServiceFactory() = default;
-
-       std::unordered_map<std::string, createFunc> _inference_service_table;
-};
-
-template<typename FactoryType> bool registerInferenceServiceFactory(const std::string &name)
-{
-       InferenceServiceFactory::instance().registerBackend(name, []() {
-               return std::unique_ptr<IInferenceServiceFactory>(new FactoryType());
-       });
-
-       return true;
-}
-
-}
-}
-
-#endif
\ No newline at end of file
diff --git a/inference/include/InferenceTaskFactory.h b/inference/include/InferenceTaskFactory.h
new file mode 100644 (file)
index 0000000..f514410
--- /dev/null
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __INFERENCE_TASK_FACTORY_H__
+#define __INFERENCE_TASK_FACTORY_H__
+
+#include <unordered_map>
+#include <vector>
+#include <string>
+#include <memory>
+#include <stdexcept>
+#include "IInferenceTaskFactory.h"
+#include "SingleoException.h"
+#include "SingleoLog.h"
+
+namespace singleo
+{
+namespace inference
+{
+class InferenceTaskFactory
+{
+public:
+       using createFunc = std::unique_ptr<IInferenceTaskFactory> (*)();
+
+       static InferenceTaskFactory &instance()
+       {
+               static InferenceTaskFactory factory;
+               return factory;
+       }
+
+       std::unique_ptr<IInferenceTaskFactory> create(const std::string &name)
+       {
+               auto it = _inference_task_table.find(name);
+               if (it != _inference_task_table.end())
+                       return it->second();
+
+               throw singleo::exception::InvalidParameter("Invalid inference service factory.");
+       }
+
+       void registerBackend(const std::string &name, const createFunc &func)
+       {
+               _inference_task_table[name] = func;
+       }
+
+private:
+       InferenceTaskFactory() = default;
+       ~InferenceTaskFactory() = default;
+
+       std::unordered_map<std::string, createFunc> _inference_task_table;
+};
+
+template<typename FactoryType> bool registerInferenceTaskFactory(const std::string &name)
+{
+       InferenceTaskFactory::instance().registerBackend(name, []() {
+               return std::unique_ptr<IInferenceTaskFactory>(new FactoryType());
+       });
+
+       return true;
+}
+
+}
+}
+
+#endif
\ No newline at end of file
index d6a0556c6f7080793e34eed83e5c189c397518db..4ed7a7ffccf726edf9eb253bc7acfe623ad7536d 100644 (file)
@@ -17,7 +17,7 @@
 #include <algorithm>
 #include "SingleoException.h"
 #include "AutoZoom.h"
-#include "InferenceServiceFactory.h"
+#include "InferenceTaskFactory.h"
 #include "SingleoLog.h"
 #include "ImagePreprocessor.h"
 #include "ServiceFactory.h"
@@ -43,11 +43,11 @@ AutoZoom::AutoZoom()
 {
        // In default, we will use Inference service factory for Mediavision to use Mediavision framework
        // for inference service. TODO. introduce meta config file approach later.
-       auto factory = InferenceServiceFactory::instance().create("MvInferenceServiceFactory");
+       auto factory = InferenceTaskFactory::instance().create("MvInferenceTaskFactory");
        auto face_detection_node = make_shared<InferenceNode>();
 
        face_detection_node->setName("face_detection");
-       face_detection_node->setInferenceService(factory->createFaceDetection());
+       face_detection_node->setInferenceTask(factory->createFaceDetection());
        _taskManager = make_unique<TaskManager>();
        _taskManager->addNode(face_detection_node);
        _postprocessor = make_unique<Postprocessor>();
index 910d170d03f3c521b7e1b9a96dddb8a7f3704255..366a0cd2821d27c5d00dcfcddaa19bfb98ac91c7 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "SingleoCommonTypes.h"
 #include "ServiceDataType.h"
-#include "IInferenceServiceInterface.h"
 
 namespace singleo
 {
index 47f3080c77698ebfcbb2b304e464777c6f598e16..5aa097fe4e16bea6db66493146e73ce3b8f20b61 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "INode.h"
 #include "SingleoException.h"
+#include "IInferenceTaskInterface.h"
 
 namespace singleo
 {
@@ -32,7 +33,7 @@ class InferenceNode : public INode
 private:
        NodeType _type { NodeType::INFERENCE };
        std::string _name;
-       std::unique_ptr<inference::IInferenceServiceInterface> _service;
+       std::unique_ptr<inference::IInferenceTaskInterface> _task;
        std::vector<std::shared_ptr<INode> > _dependencies;
        std::vector<std::shared_ptr<BaseDataType> > _inputs;
        std::shared_ptr<BaseDataType> _output;
@@ -62,8 +63,8 @@ public:
        void wait() override;
        void wakeup() override;
 
-       void setInferenceService(std::unique_ptr<inference::IInferenceServiceInterface> &&service);
-       inference::IInferenceServiceInterface *getInferenceService();
+       void setInferenceTask(std::unique_ptr<inference::IInferenceTaskInterface> &&task);
+       inference::IInferenceTaskInterface *getInferenceTask();
 };
 
 }
index 2450b76a3a402c2cb229dc73e1b75cc2c28b634d..145d923fe7c8167b1097877598041fcc64f911b3 100644 (file)
@@ -21,7 +21,7 @@
 #include <memory>
 #include <thread>
 
-#include "IInferenceServiceInterface.h"
+#include "IInferenceTaskInterface.h"
 #include "SingleoCommonTypes.h"
 #include "INode.h"
 
index 5cdc6f4001fe67922e86a3a0df30f6059a4cbc8b..3f68f20eb82e89ff1c95b432280ae97ec52dde33 100644 (file)
@@ -38,14 +38,14 @@ vector<shared_ptr<BaseDataType> > &InferenceNode::getInputs()
        return _inputs;
 }
 
-void InferenceNode::setInferenceService(unique_ptr<inference::IInferenceServiceInterface> &&service)
+void InferenceNode::setInferenceTask(unique_ptr<inference::IInferenceTaskInterface> &&task)
 {
-       _service = move(service);
+       _task = move(task);
 }
 
-IInferenceServiceInterface *InferenceNode::getInferenceService()
+IInferenceTaskInterface *InferenceNode::getInferenceTask()
 {
-       return _service.get();
+       return _task.get();
 }
 
 void InferenceNode::addDependency(std::shared_ptr<INode> node)
index abaf0b0828f8b931b6ccd7bb9f42162407347f72..50671d5e615067b6417d63ac0ac61ba8d3c46969 100644 (file)
@@ -39,7 +39,7 @@ void TaskManager::threadCb(shared_ptr<INode> &node)
                // Add the result if dependency node is inference service not callback.
                if (n->getType() == NodeType::INFERENCE) {
                        auto inferenceNode = dynamic_pointer_cast<InferenceNode>(n);
-                       results.push_back(&inferenceNode->getInferenceService()->result());
+                       results.push_back(&inferenceNode->getInferenceTask()->result());
                }
        }
 
@@ -66,7 +66,7 @@ void TaskManager::threadCb(shared_ptr<INode> &node)
                else // Else if dependency then use output of dependency node(callback node).
                        input = dynamic_pointer_cast<ImageDataType>(inferenceNode->getDependencies()[0]->getOutput());
 
-               inferenceNode->getInferenceService()->invoke(*input);
+               inferenceNode->getInferenceTask()->invoke(*input);
 
                // Inference request has been completed so release input data if the data was internally allocated by callback node.
                if (input->custom)
@@ -108,8 +108,8 @@ void TaskManager::addNode(std::shared_ptr<INode> node)
        // Initialize inference service.
        if (node->getType() == NodeType::INFERENCE) {
                auto inferenceNode = dynamic_pointer_cast<InferenceNode>(node);
-               inferenceNode->getInferenceService()->configure();
-               inferenceNode->getInferenceService()->prepare();
+               inferenceNode->getInferenceTask()->configure();
+               inferenceNode->getInferenceTask()->prepare();
        }
 }
 
@@ -166,7 +166,7 @@ vector<shared_ptr<BaseResultType> > &TaskManager::output()
        // TODO. consider for callback node support as last node.
        if (lastNode->getType() == NodeType::INFERENCE) {
                auto inferenceNode = dynamic_pointer_cast<InferenceNode>(lastNode);
-               auto &result = inferenceNode->getInferenceService()->result();
+               auto &result = inferenceNode->getInferenceTask()->result();
                if (result._type == ResultType::FACE_DETECTION) {
                        auto fd_result = dynamic_cast<FdResultType &>(result);
                        _results.push_back(make_shared<FdResultType>(fd_result));
index 5c8e315b34398667e4a949de5eaa882089a879e8..e4f221e888c743fe5ba65006e489fe4de1cee343 100644 (file)
@@ -19,8 +19,8 @@
 #include <memory>
 #include <opencv2/opencv.hpp>
 
-#include "InferenceServiceFactory.h"
-#include "IInferenceServiceInterface.h"
+#include "InferenceTaskFactory.h"
+#include "IInferenceTaskInterface.h"
 #include "SingleoCommonTypes.h"
 #include "TaskManager.h"
 #include "InferenceNode.h"
@@ -82,7 +82,7 @@ TEST(SingloTaskManager, MultipleNodesBasedGraphAShouldWork)
        image_data.byte_per_pixel = cv_image.channels();
        image_data.ptr = cv_image.data;
 
-       auto factory = InferenceServiceFactory::instance().create("MvInferenceServiceFactory");
+       auto factory = InferenceTaskFactory::instance().create("MvInferenceTaskFactory");
 
        auto taskManager = make_unique<TaskManager>();
        const unsigned int maxIteration = 10;
@@ -92,7 +92,7 @@ TEST(SingloTaskManager, MultipleNodesBasedGraphAShouldWork)
 
                auto face_detection_node = make_shared<InferenceNode>();
                face_detection_node->setName("face_detection");
-               face_detection_node->setInferenceService(factory->createFaceDetection());
+               face_detection_node->setInferenceTask(factory->createFaceDetection());
                taskManager->addNode(face_detection_node);
 
                auto callback_node = make_shared<CallbackNode>();
@@ -103,7 +103,7 @@ TEST(SingloTaskManager, MultipleNodesBasedGraphAShouldWork)
 
                auto face_landmark_node = make_shared<InferenceNode>();
                face_landmark_node->setName("face_landmark");
-               face_landmark_node->setInferenceService(factory->createFaceLandmarkDetection());
+               face_landmark_node->setInferenceTask(factory->createFaceLandmarkDetection());
                face_landmark_node->addDependency(callback_node);
                taskManager->addNode(face_landmark_node);
 
@@ -142,7 +142,7 @@ TEST(SingloTaskManager, MultipleNodesBasedGraphBShouldWork)
        image_data.byte_per_pixel = cv_image.channels();
        image_data.ptr = cv_image.data;
 
-       auto factory = InferenceServiceFactory::instance().create("MvInferenceServiceFactory");
+       auto factory = InferenceTaskFactory::instance().create("MvInferenceTaskFactory");
 
        auto taskManager = make_unique<TaskManager>();
        const unsigned int maxIteration = 10;
@@ -152,12 +152,12 @@ TEST(SingloTaskManager, MultipleNodesBasedGraphBShouldWork)
 
                auto face_detection_node_a = make_shared<InferenceNode>();
                face_detection_node_a->setName("face_detectionA");
-               face_detection_node_a->setInferenceService(factory->createFaceDetection());
+               face_detection_node_a->setInferenceTask(factory->createFaceDetection());
                taskManager->addNode(face_detection_node_a);
 
                auto face_detection_node_b = make_shared<InferenceNode>();
                face_detection_node_b->setName("face_detectionB");
-               face_detection_node_b->setInferenceService(factory->createFaceDetection());
+               face_detection_node_b->setInferenceTask(factory->createFaceDetection());
                taskManager->addNode(face_detection_node_b);
 
                auto callback_node = make_shared<CallbackNode>();
@@ -169,7 +169,7 @@ TEST(SingloTaskManager, MultipleNodesBasedGraphBShouldWork)
 
                auto face_landmark_node = make_shared<InferenceNode>();
                face_landmark_node->setName("face_landmark");
-               face_landmark_node->setInferenceService(factory->createFaceLandmarkDetection());
+               face_landmark_node->setInferenceTask(factory->createFaceLandmarkDetection());
                face_landmark_node->addDependency(callback_node);
                taskManager->addNode(face_landmark_node);
 
@@ -226,7 +226,7 @@ TEST(SingloTaskManager, MultipleNodesBasedGraphDShouldWork)
        image_data.byte_per_pixel = cv_image.channels();
        image_data.ptr = cv_image.data;
 
-       auto factory = InferenceServiceFactory::instance().create("MvInferenceServiceFactory");
+       auto factory = InferenceTaskFactory::instance().create("MvInferenceTaskFactory");
 
        auto taskManager = make_unique<TaskManager>();
        const unsigned int maxIteration = 10;
@@ -236,7 +236,7 @@ TEST(SingloTaskManager, MultipleNodesBasedGraphDShouldWork)
 
                auto face_detection_node = make_shared<InferenceNode>();
                face_detection_node->setName("face_detection");
-               face_detection_node->setInferenceService(factory->createFaceDetection());
+               face_detection_node->setInferenceTask(factory->createFaceDetection());
                taskManager->addNode(face_detection_node);
 
                auto bridge_callback_node = make_shared<CallbackNode>();
@@ -247,7 +247,7 @@ TEST(SingloTaskManager, MultipleNodesBasedGraphDShouldWork)
 
                auto face_landmark_node = make_shared<InferenceNode>();
                face_landmark_node->setName("face_landmark");
-               face_landmark_node->setInferenceService(factory->createFaceLandmarkDetection());
+               face_landmark_node->setInferenceTask(factory->createFaceLandmarkDetection());
                face_landmark_node->addDependency(bridge_callback_node);
                taskManager->addNode(face_landmark_node);