Member-only story
Shorts — FastAI V2 Batch Prediction
(Snippets from a larger article, so it is easier to find for those looking for a specific topic.)
· Code
· Explanation
∘ Updating the DataLoader
∘ Monkey Patch
· Fin
So, you trained a model and now, you want to run predictions over a lot of new images. As of today, the FastAI V2 Documentation does not talk about how to do that.
Code
Without further drama, here you go.
Explanation
So what actually happened here?
Well FastAI V1 had the ability to predict over a batch. V2 does not, yet. So we need to “monkey patch” it in.
Updating the DataLoader
To do that, we first need to add the new files to the DataLoader. We can do this in the following way.