ImageClassifierData.from_arrays() method replacement

Hello all,

I am trying to solve https://www.kaggle.com/c/digit-recognizer challenge on kaggle. I have completed my first lesson for Part 1. I see that the newer version of fastai library uses the class ImageDataBunch instead of ImageClassifierData. I want to read image data from arrays inside dataframe object similar to following:

data = ImageClassifierData.from_arrays(path=wd, 
                                   trn=(X_train, Y_train),
                                   val=(X_valid, Y_valid),
                                   classes=Y_train,
                                   test=test_df,
                                   tfms=tfms_from_model(arch, sz))

I am looking if someone could help me map to ImageDataBunch class. Thanks!

Me too. I need the ImageClassifierData.from_arrays equivalent in the new version. Help will be greatly appreciated.

Found the answer in course-v3’s lesson5-sgd-mnist. It is done via TensorDataset followed by DataBunch.create.

1 Like