If I have understood you correctly, you want to preprocess images and use the new images instead of the old ones? Then, just put the processed images into a folder and use these images as input to your ImageDataBunch and if you do not want the images to be transformed pass [] to tfms. I hope that helps.
I see. Then I think you have to change the “open” method of the DataBunch. The default is loading an image from disk, you could change this to lading and preprocessing it, for example.
I was highlighting the re-use issue of “open_image” while “learn.fit_one_cycle(1, slice(lr))” is running.
If I do “vision.data.open_image = load_format”, of course I have no problem.
However, my heavy preprocessing takes time in “learn.fit_one_cycle(1, slice(lr))” again although I already spend time when I loaded data with preprocessing.
In summary,
The image data is already preprocessed with “vision.data.open_image = load_format” when I load data.
When I use “fit”, this function seems taking preprocessing with “vision.data.open_image = load_format” again.
In my opinion, the preprocessing step should take once not every “fit”.
Maybe you could introduce a callback “preprocess_at_first_epoch”, that is only called, if you are in the first epoch. But maybe it is still the best idea to preprocess independently of the fitting and put the preprocessed data in the DataBunch. Loading the images while fitting is the standard procedure and makes absolutely sense because of memory limitations. Hope I could still help you a little bit