From d4dbdeb420c85521755b3f46d92ebe4c814049c3 Mon Sep 17 00:00:00 2001 From: Eunwoo Shin Date: Thu, 20 Jun 2024 14:02:52 +0900 Subject: [PATCH] Update exportable code dependency & fix a bug (#3642) * update a dependency of exportable code * change variable name * update unit test --- src/otx/core/exporter/base.py | 8 ++++---- .../exportable_code/demo/demo_package/model_wrapper.py | 4 ++-- .../core/exporter/exportable_code/demo/requirements.txt | 6 +++--- .../demo/demo_package/test_model_wrapper.py | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/otx/core/exporter/base.py b/src/otx/core/exporter/base.py index 939ca5165d1..8a9cbd8d1de 100644 --- a/src/otx/core/exporter/base.py +++ b/src/otx/core/exporter/base.py @@ -194,16 +194,16 @@ def to_exportable_code( raise RuntimeError(msg) if not is_ir_model and self.metadata is not None: - parameters["type_of_model"] = self.metadata.get(("model_info", "task_type"), "") - parameters["converter_type"] = self.metadata.get(("model_info", "model_type"), "") + parameters["task_type"] = self.metadata.get(("model_info", "task_type"), "") + parameters["model_type"] = self.metadata.get(("model_info", "model_type"), "") parameters["model_parameters"] = { "labels": self.metadata.get(("model_info", "labels"), ""), "labels_ids": self.metadata.get(("model_info", "label_ids"), ""), } elif is_ir_model: model_info = model.get_model().rt_info["model_info"] - parameters["type_of_model"] = model_info["task_type"].value if "task_type" in model_info else "" - parameters["converter_type"] = model_info["model_type"].value if "model_type" in model_info else "" + parameters["task_type"] = model_info["task_type"].value if "task_type" in model_info else "" + parameters["model_type"] = model_info["model_type"].value if "model_type" in model_info else "" parameters["model_parameters"] = { "labels": model_info["labels"].value if "labels" in model_info else "", "labels_ids": model_info["label_ids"].value if "label_ids" in model_info else "", diff --git a/src/otx/core/exporter/exportable_code/demo/demo_package/model_wrapper.py b/src/otx/core/exporter/exportable_code/demo/demo_package/model_wrapper.py index c6a5ec0c819..d2782afb2e7 100644 --- a/src/otx/core/exporter/exportable_code/demo/demo_package/model_wrapper.py +++ b/src/otx/core/exporter/exportable_code/demo/demo_package/model_wrapper.py @@ -43,7 +43,7 @@ def __init__(self, model_dir: Path, device: str = "CPU") -> None: raise RuntimeError(msg) self.parameters = get_parameters(model_dir / "config.json") self._labels = self.parameters["model_parameters"]["labels"] - self._task_type = TaskType[self.parameters["converter_type"].upper()] + self._task_type = TaskType[self.parameters["task_type"].upper()] # labels for modelAPI wrappers can be empty, because unused in pre- and postprocessing self.model_parameters = self.parameters["model_parameters"] @@ -53,7 +53,7 @@ def __init__(self, model_dir: Path, device: str = "CPU") -> None: self.core_model = Model.create_model( model_adapter, - self.parameters["type_of_model"], + self.parameters["model_type"], self.model_parameters, preload=True, ) diff --git a/src/otx/core/exporter/exportable_code/demo/requirements.txt b/src/otx/core/exporter/exportable_code/demo/requirements.txt index 9287e3be9eb..c40f30a932a 100644 --- a/src/otx/core/exporter/exportable_code/demo/requirements.txt +++ b/src/otx/core/exporter/exportable_code/demo/requirements.txt @@ -1,3 +1,3 @@ -openvino==2023.3.0 -openvino-model-api==0.1.8 -numpy==1.26.1 +openvino==2024.0.0 +openvino-model-api==0.2.0 +numpy==1.26.4 diff --git a/tests/unit/core/exporter/exportable_code/demo/demo_package/test_model_wrapper.py b/tests/unit/core/exporter/exportable_code/demo/demo_package/test_model_wrapper.py index eb9cdc7c6ef..d6765026896 100644 --- a/tests/unit/core/exporter/exportable_code/demo/demo_package/test_model_wrapper.py +++ b/tests/unit/core/exporter/exportable_code/demo/demo_package/test_model_wrapper.py @@ -32,8 +32,8 @@ def setup(self, mocker): "get_parameters", return_value={ "model_parameters": {"labels": "label"}, - "converter_type": "CLASSIFICATION", - "type_of_model": "type_of_model", + "task_type": "CLASSIFICATION", + "model_type": "type_of_model", }, ) mocker.patch.object(target_file, "get_model_path")