Skip to content

Commit

Permalink
Change OV model scales (#3485)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinvaidya17 authored May 10, 2024
1 parent faed8f7 commit b01382f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
7 changes: 0 additions & 7 deletions src/otx/algo/anomaly/openvino_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,3 @@ def predict_step(self, inputs: AnomalyModelInputs, batch_idx: int) -> list[Anoma
def _customize_outputs(self, outputs: list[AnomalyResult], inputs: AnomalyModelInputs) -> list[AnomalyResult]:
"""Return outputs from the OpenVINO model as is."""
return outputs

def _customize_inputs(self, inputs: AnomalyModelInputs) -> dict[str, np.ndarray]:
"""Return inputs as is."""
inputs = super()._customize_inputs(inputs)
# model needs inputs in range 0-1
inputs["inputs"] = [value / 255.0 for value in inputs["inputs"]]
return inputs
4 changes: 2 additions & 2 deletions src/otx/core/model/anomaly.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def _get_values_from_transforms(
if "Resize" in name:
image_size = tuple(transform.size) # type: ignore[assignment]
elif "Normalize" in name:
mean_value = tuple(transform.mean) # type: ignore[assignment]
std_value = tuple(transform.std) # type: ignore[assignment]
mean_value = tuple(value * 255 for value in transform.mean) # type: ignore[assignment]
std_value = tuple(value * 255 for value in transform.std) # type: ignore[assignment]
return image_size, mean_value, std_value

@property
Expand Down
2 changes: 1 addition & 1 deletion src/otx/recipe/anomaly_detection/stfpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ engine:
task: ANOMALY_DETECTION
device: auto

callback_monitor: image_F1Score
callback_monitor: pixel_F1Score

data: ../_base_/data/torchvision_base.yaml
overrides:
Expand Down
2 changes: 1 addition & 1 deletion src/otx/recipe/anomaly_segmentation/stfpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ engine:
task: ANOMALY_SEGMENTATION
device: auto

callback_monitor: image_F1Score
callback_monitor: pixel_F1Score

data: ../_base_/data/torchvision_base.yaml
overrides:
Expand Down

0 comments on commit b01382f

Please sign in to comment.