How do I get my list of predictions match the order of the images in my test folder?

He memen7omori,

I just checked my code and found this:

ds_idx, predicted_class, probability = bad_predictions[0]
fn = learner.data.valid_ds.x.items[ds_idx]

So yes the Image does not have a reference to its path but if you have the ds_idx (i in the loop above) you can query the DataBunch / the associated ImageList for the file name.

HTH

1 Like