Select Data to Be Processed On Forward Call

Hello!

I’m developing a model for classification of Images with Gigapixel size and multiple levels of amplification. Due to this fact, this images need to be divided in multiple patches across the different amplifications.

I want my model to process patches at an amplification level m, give them a confidence score and, according to that score, select the corresponding patches at a higher level of amplification n to then be processed as well.

I’m using http requests to fetch the patches at different magnifications. However, I do not want to make several http requests to fetch all the patches at level n, since I might not be using a good part of them.

The only approach I can think of is, in the model’s forward function, after getting the scores for patches at level m, make the http calls to the necessary patches at level n and process them. However, this doesn’t look like a good practice.

Is there any other good way to do this?