ImageDataBunch attributes (number of images)

How to check the number of images inside an existing ImageDataBunch?

Thnx,
Barak

Suppose you have a image data bunch object data_f:

data_f = ImageDataBunch.from_name_re(path=path, 
                                     pat='([^/]+)_\d+.jpg$',
                                     fnames=img_paths3, test="/content/test/",
                                     bs=bs, size=48)
                                   

You can type the variable name and run the cell,

data_f

which will give you output something like this

ImageDataBunch;

Train: LabelList (4290 items)
x: ImageList
Image (3, 48, 48),Image (3, 48, 48),Image (3, 48, 48),Image (3, 48, 48),Image (3, 48, 48)
y: CategoryList
Neutral,Happy,Angry,Angry,Disgust
Path: /content/data;

Valid: LabelList (1072 items)
x: ImageList
Image (3, 48, 48),Image (3, 48, 48),Image (3, 48, 48),Image (3, 48, 48),Image (3, 48, 48)
y: CategoryList
Disgust,Surprise,Neutral,Sad,Neutral
Path: /content/data;

Test: LabelList (7178 items)
x: ImageList
Image (3, 48, 48),Image (3, 48, 48),Image (3, 48, 48),Image (3, 48, 48),Image (3, 48, 48)
y: EmptyLabelList
,,,,
Path: /content/data
1 Like

Thanks!

1 Like