Dog Breed Identification challenge

Hey Thanks that worked well.

I just realized the Test folder was empty :grinning:. Will upload a new dataset folder shortly

@jamesrequa I see you started submitting, did you build upon Jeremy’s notebook demo in class ?
If so, how did you move from training to actual prediction & submit with the fastai library ?

Yep I just built on the lesson 1 notebook with a couple of differences, outlined below:

  1. I used from_csv instead of from_paths since this dataset isn’t provided in sub-folders by class. Jeremy covers all of this in Lesson 2, but its pretty much just a matter of passing in the train csv file name and paths to image folders. You also need to assign the validation set. Make sure you also provide the path to the test images here as the test_name argument otherwise it won’t be able to find the test images when you run predictions after training.

  2. When you are finished training and ready to run predictions on the test set you just need to use learn.predict(is_test=True). You can also do TTA the same way as you normally would just making sure to pass in is_test=True since you are using the test set not the validation set.

  3. You’ll also need to convert the raw predictions to probabilities i.e. test_preds = np.exp(test_preds).

  4. From there you just create the submission file using the probabilities. It should already be in the correct shape. One last thing to be careful about is the sorting/ordering of the predictions. When I first submitted to Kaggle, in fact, I had the wrong sorting (I used the default ordering in the sample submission file) and got really bad scores as a result. You can be sure its correct just by using data.test_dl.dataset.fnames as your test image ids.

That’s basically it!

24 Likes

@jeremy

I’ve tried to duplicate your notebook, as shown in last night second-half.
It works fine when I use “regular” model names in Cell #3 as arch=resnet50 (or resnet101), though with lower accuracy (0.89 vs 0.92)

But if I enter arch=resnext101_64, when I run the first learn = ConvLearner.pretrained(arch, data, precompute=True), it generates an error as:

Preformatted text`FileNotFoundError: [Errno 2] No such file or directory: ‘/media/eric/SSD500/fastai-master2/courses/dl1/fastai/weights/resnext_101_64x4d.pth’

Same with inception_4

I did a git pull a few minutes ago, no fix.

2 Likes

@EricPB You just need to download the weight files here and put them in the fast.ai directory.
http://files.fast.ai/models/weights.tgz

10 Likes

Thx !
Downloading now (without the ‘4’ at the end of the url :-))

1 Like

Oops just edited the link, thanks!

Nasty bugger :spy:

One night works and first ever submission got me top15 in the competition!

Thanks @jeremy for this amazing course! and also @jamesrequa @sermakarevich for the all tips in the discussion!

8 Likes

You can use arch = resnext101 without the 64, I assume resnext101_64 is another model. That works for me without having to download the weights.

2 Likes

@jakcycsl Nice work!!

1 Like

Hi Guys, Did you resized the images to 224 or 299. I resaw the video and Jeremy didn’t mention to resize. But there is code block which does the resize. Just want to know how you are handling that

@satish860 It’s sz parameter. Try different values to see which is better. Jeremy gave a hint to look at sizes distribution.

@jakcycsl Congrats! I assume 10-th place is a group of students from some other dl course )

Interesting question from @Moody in another thread

1 Like

@jeremy explains why he used the resize trick, from 224 to 299, here.
It’s cutting-edge SOTA secret sauce, don’t tell anyone :sunglasses:

6 Likes

I got this error when I tried to make predictions for test set.
Does anybody help me solve this issue?
Thanks in advance :slight_smile:

@rikiya The same thing happened to me and only with TTA predictions.

To solve it, you should be able to edit it slightly as below:
test_probs = np.exp(test_log_preds[0])

3 Likes

@jamesrequa That worked perfectly, thanks a lot :smiley:

1 Like

TTA returns a tuple. The 2nd item are the y values.

2 Likes

@jeremy this makes sense for predicting on the validation set but for the test set we don’t have any y values so in that case shouldn’t learn.TTA(is_test=True) just return the predictions?

If you agree I could submit a PR for it. :slight_smile:

2 Likes