I have a dataset with high resolution images, instead of using the whole image i want to create a sliding window to generate images for training(random crop is not useful as it may not use the whole image for training). This is possible using keras generator but can this be done using fastai
I’ve been trying to do something similar - 100x100px tiles from 2k px images in the Div2K dataset - on a super resolution task using a custom ImageImageList
. So far I’ve managed to get the x
's with a custom open
function but I’ve not been able to match the y
's as yet, though the code for SegmentationLabelList
points to how it might be done. I see examples in pytorch - quite simple - but am still getting my head around fastai’ing it.
The question has been asked before, eg Lesson 3 Advanced Discussion ✅ and Split large satellite image into tiles/patches?
Conventionally in fastai one creates and saves files of crops but ideally I’d like to generate my x/y crops on the fly without saving more files.
If anyone has made progress in the area, please chime in.
@digitalspecialists Did you manage to do this? I’m trying to apply multiple labels to multiple bounding boxes (see here), so am interested in this!
Use the get_annotations function to help with creating a sliding window. If you’re working with high-resolution images, you can also leverage ImageDataLoaders and customize the transformations.
I’ve had a similar challenge and ended up using a sliding window technique with Keras, but I was curious about fastai too. From my experience, fastai can handle custom data loaders pretty flexibly, so you might be able to create a sliding window generator by customizing the data block API. It might take a bit of tweaking, but it’s definitely doable.
I’ve been experimenting with an AI image generator free tool recently, which has been fun for generating various image styles and augmentations. It’s a handy addition to any image processing toolkit.