How to correlate results of get_preds with the files they belong with?

I have code working to run

results = learn.get_preds(ds_type=DatasetType.Test)

How do I correlate the results with the filenames in my test folder?

learn.data.test_ds.x.items gives you a list of pathlib filepaths. I think it corresponds to the unshuffled ordering of the test set. You can get the filename from a pathlib filepath by calling .name on the object.

3 Likes