Fastai for Kaggle Digit recogniser

Hello all!

As the topic suggest I am tinkering with hand written digits dataset on Kaggle and trying to improve my results with fastai library.

Here is what I have done so far.

I appreciate that I might have not chose the simplest way of converting csv pixel data values into a pictures, however it does produce desirable result - I am getting correctly labeled training images.

Now, the hurdle that I stumbled upon is how to run trained model on test data. Here is the snippet of code for ImageBunch:

train_path_img = "../working/images/train"
train_fnames = get_image_files("../working/images/train/")
test_path_img = "../working/images/test"
test_fnames = get_image_files("../working/images/test/")

data = ImageDataBunch.from_name_re(train_path_img,
                                  rain_fnames,
                                  pat,
                                  test=test_path_img,
                                  ds_tfms=get_transforms(do_flip=False),
                                  size=28, bs=64, num_workers=0).normalize(imagenet_stats)

I mean, I ran learn on train data but how do I apply model on test data? Also, if any one could share the code that can be used to output values to submission file, please - I’d greatly appreciate that.

Thanks!

As given here:
https://docs.fast.ai/data_block.html#Add-a-test-set
, the best way to run on test data is to make a new Databunch with a separate validation set and then use YOURDATABUNCH.validate() to get metrics. I am not sure what you mean by output values to the submission file.