Library api for upscaling data(vision) for reducing overfitting

I remember that previous version of fastai library has some nifty functions/methods on learner object for resizing data, used primarily for being able to continue training while preventing overfitting in the finetuning steps.

Something like

learner.load(f'stage-5')

upscale_size=299
reduce_batch_size=32 

learner.set_data(get_data(upscale_size, reduce_batch_size)) 
learner.f..

was possible.

I’ve been trying to read the docs and skim the source to find something similar in this version. But, it looks like the API for doing something similar has changed. I’m assuming that I need to use callbacks in some fashion, but I’m not exactly sure how.

Maybe @sgugger can provide some hints on how to go about implementing this.

3 Likes

I haven’t tried it yet, but I suspect it’s just a case of setting learner.data = ...

1 Like

I have tested and it seems to be working

data = ImageDataBunch.from_folder(path, test='test', ds_tfms=get_transforms(), size=512)
data.normalize()
learn.data = data
4 Likes