Which images are in the validation set?


I am working on an image regression problem and I am wondering how do I know which images are in my training and validation set? When I use data.show_batch() or learn.show_results it shows the image and the value associate with the regression. I want to know which image files these correspond too.

To set different datasets in fastai you have to set ds_type to one of these values.

  • DatasetType.Train
  • DatasetType.Valid
  • DatasetType.Test

So if I want to use data.show_batch for validation images, I would use data.show_batch(ds_type=DatasetType.Valid).

1 Like

Thanks for the response. What I am trying to get is the actual image file names that are in the training and validation set.

For example if I print the output of my data bunch I get the following:

Train: LabelList (2731 items)
x: ImageList
Image (3, 450, 450),Image (3, 450, 450),Image (3, 450, 450),Image (3, 450, 450),Image (3, 450, 450)
y: FloatList

I need information about which images actually make up this set. I could determine it by matching the y values to my list of image files and target values but is there a simpler way?

Look at the ClassConfusion widget. I designed it for that. It works both in Jupyter and Colab

Use data.train_ds.items to get the paths of training images and data.valid_ds.items for valid images.


I want to add this if you want to see results only from the validation set you can try this: