Skip to content

Commit

Permalink
Add a dummy hierarchical config required by MAPI (openvinotoolkit#2483)
Browse files Browse the repository at this point in the history
  • Loading branch information
sovrasov authored and yunchu committed Sep 20, 2023
1 parent 689abff commit 7c43e40
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/otx/algorithms/classification/adapters/openvino/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from otx.algorithms.classification.configs import ClassificationConfig
from otx.algorithms.classification.utils import (
get_cls_deploy_config,
get_cls_inferencer_configuration,
get_hierarchical_label_list,
)
from otx.algorithms.common.utils import OTXOpenVinoDataLoader
Expand Down Expand Up @@ -113,7 +114,19 @@ def __init__(
max_num_requests=num_requests,
plugin_config={"PERFORMANCE_HINT": "THROUGHPUT"},
)
self.model = Model.create_model(model_adapter, "Classification", {}, preload=True)
self.configuration = get_cls_inferencer_configuration(self.label_schema)

# create a dummy hierarchical config for backward compatibility, which is not actually used
if self.configuration["hierarchical"]:
try:
model_adapter.get_rt_info(["model_info", "hierarchical_config"])
except RuntimeError:
self.configuration["hierarchical_config"] = json.dumps(
{"cls_heads_info": {"label_to_idx": [], "all_groups": []}, "label_tree_edges": []}
)

self.model = Model.create_model(model_adapter, "Classification", self.configuration, preload=True)

self.converter = ClassificationToAnnotationConverter(self.label_schema)
self.callback_exceptions: List[Exception] = []
self.model.inference_adapter.set_callback(self._async_callback)
Expand Down

0 comments on commit 7c43e40

Please sign in to comment.