How to get data.val_ds.fnames in fastai v1.0

Hi,

I have been looking the source code and the docs for hours. I need to get the filenames of the validation set once the ImageDataBunch has been created. In fastai v0.7 I used data.val_ds.fnames.

I can’t find any equivalent property in Fastai v1.0. data.valid_ds is a LabelList that does not provide the filenames (or at least I can’t find them).

I used these filenames in order to perform a detailed error analysis on the validation set.

Help please!!!

I think its valid_ds.items,
I too searched for a rather long time for this

I found it somehwere in the depths of https://github.com/fastai/fastai/blob/master/fastai/basic_data.py

I think It should go into the docs though.

1 Like

Can this help ?

data.valid_ds.x.items[:]

  • data is the ImageDataBunch object
  • valid_ds is the default name of the validation set
  • x is the image item list
1 Like

This is what I was looking for! :partying_face: data.valid_ds.items outputs an array with the path to the image files. Many thanks!!!

I think that filenames are not included in data.valid_ds.x.items. The correct answer is valid_ds.items :slight_smile:

You can also look for data.xtra. of data frame passed to Image item list.data.xtra is an array of df rows with its columns as header.

1 Like