Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change OV model scales #3485

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading