Change batch size?

(Gvido) #1

hi, i read somewhere that default batch size is 64, im using my own data set and i only have 80 pics, i wish to change the batch size, any idea where i can do it?

(Less ) #2

Hi there,
The batch size is the bs parameter in the ImageClassifierData object:

data = ImageClassifierData.from_csv(PATH, ‘train’,
f’{PATH}labels.csv’, test_name=‘test’, num_workers=4,
val_idxs=val_idxs, suffix=’.jpg’, tfms=tfms, bs=bs)

data = ImageClassifierData.from_paths(PATH, bs=2, tfms=tfms, num_workers=1)

You can just set the bs to whatever you want at creation, the default as you noted is 64.

Note use learn.set_data(new ImageClassifier) to change datasets and things like batch size, w/o losing your training so far.

Best regards,

(Stas Bekman) #3

or simpler: = 32

Though we really need an API to do this kind of updates.