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

Fix duplicated size parameter value in ExportableCenterCrop #2203

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all 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
5 changes: 3 additions & 2 deletions src/anomalib/data/transforms/center_crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from collections.abc import Sequence
from typing import Any

import torch
Expand Down Expand Up @@ -77,9 +78,9 @@ class ExportableCenterCrop(Transform):
size (int | tuple[int, int]): Desired output size of the crop.
"""

def __init__(self, size: int | tuple[int, int]) -> None:
def __init__(self, size: int | Sequence[int]) -> None:
super().__init__()
self.size = list(size) if isinstance(size, tuple) else [size, size]
self.size = list(size) if isinstance(size, Sequence) else [size, size]

def _transform(self, inpt: torch.Tensor, params: dict[str, Any]) -> torch.Tensor:
"""Apply the transform."""
Expand Down
Loading