How to get prediction using get_preds in fastai 2?

Hello, I have used Imagedataloader to load the train images and also trained my learner on it, but now i want to get prediction using get_preds() on my test images my test images are in a TEST Folder this folder has 300 mixed images. How to do it using get_preds and also how to set test path data loader.

Thanks!!

1 Like

you can use fastai learner’s add_test() method to replace the learner’s original test set with your data.

you can do:

files = get_image_files(TEST_FOLDER)
test_dl = learn.dls.test_dl(files)
preds = learn.get_preds(dl=test_dl)

add_test does not work anymore.

Thanks for sharing this .