Image generator from images instead of folders (Segmentation task)

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.