diff --git a/requirements/openvino.txt b/requirements/openvino.txt index e91ed69252a..16acdba61be 100644 --- a/requirements/openvino.txt +++ b/requirements/openvino.txt @@ -2,7 +2,7 @@ # OpenVINO Requirements. # nncf==2.6.0 onnx==1.13.0 -openvino-model-api==0.1.6 +openvino-model-api==0.1.8 openvino==2023.0 openvino-dev==2023.0 openvino-telemetry==2023.2.* diff --git a/src/otx/algorithms/anomaly/tasks/openvino.py b/src/otx/algorithms/anomaly/tasks/openvino.py index a8dfa580e15..d96516a5752 100644 --- a/src/otx/algorithms/anomaly/tasks/openvino.py +++ b/src/otx/algorithms/anomaly/tasks/openvino.py @@ -188,13 +188,17 @@ def infer(self, dataset: DatasetEntity, inference_parameters: InferenceParameter label = self.anomalous_label if image_result.pred_score >= 0.5 else self.normal_label elif self.task_type == TaskType.ANOMALY_SEGMENTATION: annotations = create_annotation_from_segmentation_map( - pred_mask, image_result.anomaly_map.squeeze(), {0: self.normal_label, 1: self.anomalous_label} + pred_mask, + image_result.anomaly_map.squeeze() / 255.0, + {0: self.normal_label, 1: self.anomalous_label}, ) dataset_item.append_annotations(annotations) label = self.normal_label if len(annotations) == 0 else self.anomalous_label elif self.task_type == TaskType.ANOMALY_DETECTION: annotations = create_detection_annotation_from_anomaly_heatmap( - pred_mask, image_result.anomaly_map.squeeze(), {0: self.normal_label, 1: self.anomalous_label} + pred_mask, + image_result.anomaly_map.squeeze() / 255.0, + {0: self.normal_label, 1: self.anomalous_label}, ) dataset_item.append_annotations(annotations) label = self.normal_label if len(annotations) == 0 else self.anomalous_label @@ -202,13 +206,12 @@ def infer(self, dataset: DatasetEntity, inference_parameters: InferenceParameter raise ValueError(f"Unknown task type: {self.task_type}") dataset_item.append_labels([ScoredLabel(label=label, probability=float(probability))]) - anomaly_map = (image_result.anomaly_map * 255).astype(np.uint8) heatmap_media = ResultMediaEntity( name="Anomaly Map", type="anomaly_map", label=label, annotation_scene=dataset_item.annotation_scene, - numpy=anomaly_map, + numpy=image_result.anomaly_map, ) dataset_item.append_metadata_item(heatmap_media) update_progress_callback(int((idx + 1) / len(dataset) * 100)) diff --git a/src/otx/api/usecases/exportable_code/demo/requirements.txt b/src/otx/api/usecases/exportable_code/demo/requirements.txt index eb4d7eb29fd..ee7aaa3aaa5 100644 --- a/src/otx/api/usecases/exportable_code/demo/requirements.txt +++ b/src/otx/api/usecases/exportable_code/demo/requirements.txt @@ -1,4 +1,4 @@ openvino==2023.0 -openvino-model-api==0.1.6 -otx==1.4.4 +openvino-model-api==0.1.8 +otx @ git+https://github.com/openvinotoolkit/training_extensions/@4abe2ea89680d4bdf54f97e1fa78abebd65c7e36#egg=otx numpy>=1.21.0,<=1.23.5 # np.bool was removed in 1.24.0 which was used in openvino runtime diff --git a/src/otx/api/usecases/exportable_code/prediction_to_annotation_converter.py b/src/otx/api/usecases/exportable_code/prediction_to_annotation_converter.py index 90ba92a0c4e..22a60455231 100644 --- a/src/otx/api/usecases/exportable_code/prediction_to_annotation_converter.py +++ b/src/otx/api/usecases/exportable_code/prediction_to_annotation_converter.py @@ -370,7 +370,7 @@ def convert_to_annotation(self, predictions: AnomalyResult, metadata: Dict[str, assert predictions.pred_mask is not None assert predictions.anomaly_map is not None annotations = create_annotation_from_segmentation_map( - predictions.pred_mask, predictions.anomaly_map, self.label_map + predictions.pred_mask, predictions.anomaly_map / 255.0, self.label_map ) if len(annotations) == 0: # TODO: add confidence to this label