How to assign each tile a class after tiling a big image and pass the tiles data directly into a trainer #1673
-
Hi lets say I have a huge image of high resolution and the content of the image is a repetitive pattern. There are some defective spots in the image and after tiling the image each defective spot is contained in a single tile. The rest tiles are good parts. I'd like to tile the image use the tiler and use these tiles for patchcore and directly pass the good parts into the datamodule as the normal cases and the bad ones as abnormal cases. Could you share some hints how I can achieve this without saving the tile images into separate folders. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I believe this falls to @blaz-r's expertise :) @blaz-r can you provide your insights? |
Beta Was this translation helpful? Give feedback.
With the current tiler this would probably be a bit tricky. You could modify the tiler code here:
https://github.com/openvinotoolkit/anomalib/blob/6412fe1fa125e7a0387d14755ebf7ee5a6f0ec8e/src/anomalib/data/utils/tiler.py#L250-L273
to index out the parts that are anomalous around line 270. This would be a bit hacky to code due to way untiling works.
If the resolution is really large, that'd probably cause issues in any case, so I believe that splitting the image in advance would be easier.
With the upcoming tiled ensemble, this would be much easier but would still require some modifications to the code.