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]: Use of Tiler.untile not possible without running tile in the same scope #2496

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

Comments

@AntiLibrary5
Copy link

Describe the bug

Using untile() without running tile() first is not possible. Also this is not clear in the documentation

Dataset

N/A

Model

N/A

Steps to reproduce the behavior

Following gives an idea when tiling has been done separately and it is in interest to untile later:

    inference_dataset = WaferDataset(config, stage='inference')
    inference_dataset.dataset.load_image_paths(inference_paths)
    inference_loader = inference_dataset.get_dataloader()
    for tiles, metadata in inference_loader:
        logger.info(tiles.shape)
        logger.info(metadata)
        # untile
        untiled = inference_dataset.dataset.untile_image(tiles=tiles.squeeze(0), metadata=metadata)
        logger.info(untiled.shape)

OS information

OS information:

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

Expected behavior

Hi
As the title mentions, it should be possible to use the untile() given the right params. But the way the current implementation is, one needs to run tile() on an input tensor which initializes a bunch of variables for the object of the Tiler which are used downstream for untiling. So if someone wants to tile at one point and then untile at another (imagine a usecase of saving tiled images then loading them up and untiling separately), it wont work

Screenshots

No response

Pip/GitHub

pip

What version/branch did you use?

No response

Configuration YAML

NA

Logs

File "C:\Users\v.arora\PycharmProjects\IterMaskUnity\src\data\infer\dataset.py", line 55, in untile_image
    return self.tiler.untile(tiles)
  File "C:\Users\v.arora\AppData\Local\anaconda3\envs\itermask_unity\lib\site-packages\anomalib\data\utils\tiler.py", line 431, in untile
    image = self.__fold(tiles)
  File "C:\Users\v.arora\AppData\Local\anaconda3\envs\itermask_unity\lib\site-packages\anomalib\data\utils\tiler.py", line 302, in __fold
    image_size = (self.batch_size, num_channels, int(self.resized_h * scale_h), int(self.resized_w * scale_w))
AttributeError: 'Tiler' object has no attribute 'batch_size'

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