Lesson 2 In-Class Discussion

I looked into the Kaggle CLI a few days ago and ran into this same issue that’s open against the repo (FYI @jeremy)

I don’t have access. We have to wait for Jeremy.

Jeremy just mentioned one of the ways that data is provided either with images in a folder, or csv with the labels. There’s also another way that I’ve seen where we are basically given the pixels in a file for e.g with MNIST rather than an actual image. Does fastai library support this?

1 Like

It calculates the activations for the layers and caches the activations in a folder called tmp

2 Likes

Did you agreed to the terms of Kaggle to participate in that competition? You have to do that on Kaggle before using the kaggle CLI.

I believe this kaggle dogs vs cats competition expects results as log-loss.

I did, but it looks like he’s already added the fix from the issue last week.

@jeremy what is the good number for validation set. if the dataset has millions of data. still 20% is required?

Is there a reason for 224x224 and 299x299? Is that the default imagenet sizes or something?

1 Like

See ImageClassifierData.from_arrays

1 Like

Does the train:test split account for the class imbalance in the data?

2 Likes

Could @jeremy be sharing the notebook for the dog breeds one he is going through now? It would help in reference while doing it on our own.

4 Likes

I think because of competition rules, he is not allowed to do so.

Thanks @zaoyang

Having same learning rate for all layers is what typically used but @jeremy says that its best to have same learning rate for a set of layers i.e. same learning rate for layer 1 to 3 and same for Layer4 and 5. Two main reasons why I think it will work is-

  1. Each layer will have different shape of their objective function and using same learning rate for all layer, convergence might not be proper for all layers, hence we might get sub-optimal results
  2. If images on which we are creating model is similar to ImageNet data, then initial layers of resNet have already learnt the initial basics image features like diagonal boundaries, curves etc. and for these we don’t need lot of fine tuning, hence a low learning rate as compared to top most layer will work the best

Hope this explains!

1 Like

For the same model, how can you switch image size from 224x244 to 299x299? Shouldn’t the image dimensions fit the expected input image dimensions of the model?

2 Likes

You’ll see something similar in various papers that attempt to create scale-invariant and scale-variant CNNs.

1 Like

The convolutional layers don’t have any expectations on how big the image needs to be.

Doesn’t changing the size of the input image make the size of the output convolutions incorrect for the final dense layers? I.e. would the final dense layers need to have more weights?

Agreed, but once you decide upon 1 dimension, that is taking into account to create the dimensions of weights of the 1st layer.

So without changing the model, how can one change input image dims on the fly?

2 Likes