Skip to content

Commit

Permalink
Update exportable code dependency & fix a bug (#3642)
Browse files Browse the repository at this point in the history
* update a dependency of exportable code

* change variable name

* update unit test
  • Loading branch information
eunwoosh authored Jun 20, 2024
1 parent f2ff979 commit d4dbdeb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/otx/core/exporter/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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,
)
Expand Down
6 changes: 3 additions & 3 deletions src/otx/core/exporter/exportable_code/demo/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit d4dbdeb

Please sign in to comment.