Tiling image, getting predictions and assembling output in order

Hi everybody,

I have recently build an algorithm that makes use of ResNet 50 and trained it on a custom database for class prediction of image tiles. It works like a charm and produces predictions of high accuracy.
I am very pleased.

Now I am trying to upgrade the program. The tiles are taken from larger images and I produce the tiles with a small script. I then use ImageFolder and Dataloader to pipeline the tiles into the model.
However, I would much rather automate the process of creating the tiles to reduce the manual inputs.

For this I have been looking at something like:
tiles = image.data.unfold(0, 3, 3).unfold(1, 50, 50).unfold(2, 50, 50) # tile size 50 by 50,
but I am at a bit of a loss as to how to apply transformations to this and feed the tiles to the model.

The other end of the program needs to produce a heatmap of the results that is reassembled with the results in the correct place of the respective tile. I can produce color coded tiles based on the predictions easy enough, but I am not sure how to keep track of the correct order of the tiles through ImageFolder and Dataloader.

Any comments are appreciated. If there are examples where similar things have been done that people are aware of, great.

Many thanks.

I have figured out a solution where I split the larger image into a list of tiles and then run one big loop in which I pass one tile at a time to the model.
Maybe not pretty, but it works pretty well.

I had to tile my images to train my object detection model. For prediction I was wondering how you did reassembled the output into one complete image ?
Thank you