Dog Breed Identification challenge

Thanks @sermakarevich. For my submission I just used the preds after doing the np.exp on the output of learn.predict(is_test=True). For the ids of the test images that correspond to these predictions I used sample_submission.csv and took the ids column.

I want to validate if I have understood your response correctly. Before running the learn.predict() on the test set, the test.index needs to be set as per what you have mentioned. Then the ids that are entered in the submission file also need to be taken from the same index. Is this correct?

Iā€™m assuming you have the latest version of kaggle-cli installed and youā€™ve reconfigured it for credentials?

1 Like
columns = pd.read_csv('../../../dogs/sample_submission.csv', index_col='id').columns
test = learn.TTA(is_test=True)[0]
test = pd.DataFrame(np.exp(test))
test.columns = columns
test.index = [i.split('.jpg')[0].split('/')[-1] for i in data.test_dl.dataset.fnames]
test.index.name ='id'
4 Likes

Yup! I did it again and it just wouldnā€™t download using the cli.

While downloading (via kg download), the Crestle terminal displays a message:

downloading https://www.kaggle.com/c/dog-breed-identification/download/labels.csv.zip and then throws that warning that you see.

When I click on this download link, Iā€™m able to download the labels.csv.zip file but somehow kaggle-cli is not able to do it itself.

Huh. At this point the only other thing Iā€™d recommend trying is to reinstall kg and recreate your Kaggle credentials. Definitely looks like a credentials issue.

1 Like

Itā€™s solved now. Thanks! :slight_smile:

Thanks :+1:

@sermakarevich based on your suggestions I have been able to resubmit and now have a log loss of 0.24. Thanks for all the help.

3 Likes

Congrats @rikiya and @jamesrequa for beating 0.16 loss level. Can you please share your approaches in general?

2 Likes

I wish I could say I had some ā€œsecret formulaā€ but honestly I have literally just been following the general steps that we have learned so far. The only difference is for dog breed I skip the unfreeze section entirely. Because of that I am not using any differential learning rates but I am using cycle_len and cycle_mult. Also I am being a bit selective with my ensemble which simply contains bagged avg of a few models. So make sure if you are also taking the avg of multiple models that you check how each one is contributing to the overall score. If you start by just combining a bunch of them together from the start you may not realize that one of them could actually be hurting your score :slight_smile:

Anyway now there are a few more ppl on the LB that are around 0.10 log loss so I think there is still room for improvement (assuming they are not cheating)

7 Likes

Some of them look too solid for cheating, so yeah, it looks like <0.1 is possible.

I try to use this oof predictions on train to check what and how to blend. But I stacked on trying to make all steps from lessons work. Cant achieve any improvement when use cycle_len and cycle_mult compared to just step by step lr decrease.

Thereā€™s a kernel that gets 0.07 IIRC. The trick is to simply use the Imagenet model directly without removing any layers at all - i.e. take advantage of the pre-trained fully connected layer too. In practice this is almost never useful, but in this case because itā€™s a subset of imagenet in the competition, you can use these trick.

9 Likes

Congrats @jamesrequa and @rikiya!

1 Like

How would we implement this with fastai? If I understand correctly all of the models we are using here have the top layers for the original models switched out.

1 Like

I was thinking imagenet models should give ~ 80% accuracy without fine tuning as this is their score. After fine tuning we get 94-95% accuracy.

I have a couple of ideas. One look at this notebook that I just created.

https://github.com/yanneta/pytorch-tutorials/blob/master/modified_VGG.ipynb

The second approach is to train a linear model on the predictions of the imagenet networks.

3 Likes

Thatā€™s what the lb=0.07 kernel does

Thanks @sermakarevich, though, me too, no secret here :sweat:
My approach seems almost the same as @jamesrequaā€™s.
I skipped unfreeze, and trained with all but one training data. I have been tried 3 models so far, and submitted an ensemble of some of them, each of them scored around 0.19-0.20.
Other than that, I just followed what @jeremy taught in the lesson.

Thanks @jeremy, Iā€™ll check out the 0.07 kernel :wink:

3 Likes

Here he gets 0.4 with ResNet50: https://www.kaggle.com/yangpeiwen/keras-inception-xception-0-47

Is it possible to do the same with the fastai lib?

Check out the CIFAR 10 post I just posted - it shows how to use a model without changing it at all. You can use this approach to use a full imagenet model.

4 Likes