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

[Bug]: Tiler #2494

Open
1 task done
AntiLibrary5 opened this issue Jan 9, 2025 · 0 comments
Open
1 task done

[Bug]: Tiler #2494

AntiLibrary5 opened this issue Jan 9, 2025 · 0 comments

Comments

@AntiLibrary5
Copy link

Describe the bug

With anomalib v1.2

where looking into the init of Tiler:

    def __init__(
        self,
        tile_size: int | Sequence,
        stride: int | Sequence | None = None,
        remove_border_count: int = 0,
        mode: ImageUpscaleMode = ImageUpscaleMode.PADDING,
    ) -> None:
        self.tile_size_h, self.tile_size_w = self.validate_size_type(tile_size)
        self.random_tile_count = 4

        if stride is not None:
            self.stride_h, self.stride_w = self.validate_size_type(stride)

        self.remove_border_count = remove_border_count
        self.overlapping = not (self.stride_h == self.tile_size_h and self.stride_w == self.tile_size_w)
        self.mode = mode

so stride_h is undefined when stride is None which is an undesired behaviour.

Dataset

N/A

Model

N/A

Steps to reproduce the behavior

from anomalib.data.utils.tiler import Tiler
image = # load image
tiler = Tiler(
            tile_size=tile_size,
            stride=stride,
        )
tiler.tile(image)

Throws the error

lib\site-packages\anomalib\data\utils\tiler.py", line 172, in __init__
    self.overlapping = not (self.stride_h == self.tile_size_h and self.stride_w == self.tile_size_w)
AttributeError: 'Tiler' object has no attribute 'stride_h'

OS information

OS information:

  • OS: Win11
  • Python version: 3.10
  • Anomalib version: 1.2
  • PyTorch version: 2.5

Expected behavior

Throws the error

lib\site-packages\anomalib\data\utils\tiler.py", line 172, in __init__
    self.overlapping = not (self.stride_h == self.tile_size_h and self.stride_w == self.tile_size_w)
AttributeError: 'Tiler' object has no attribute 'stride_h'

Screenshots

No response

Pip/GitHub

pip

What version/branch did you use?

No response

Configuration YAML

NA

Logs

NA

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant