Lesson 2 In-Class Discussion ✅

The model isn’t evenly trained. There’s the resnet backbone, which has been extensively trained on all of Imagenet, and the head, which we add on for our classification purpose and is entirely untrained.

If you trained the entire model at once, you could get large errors coming from the untrained layers back propagating through the model and messing up your nicely pretrained weights.

Training with the backbone frozen allows us to only trained the untrained layers in the head. Once those layers have converged somewhat, we unfreeze the entire model and continue training.

12 Likes

Its OK. I just saw what you meant. It was good question.

“The cycle length of the total move up and down is accros the number of epochs.”
Thanks a lot - that’s important to understand!

1 Like

When you first access models.resnet34 you get a progress bar while it downloads the model to disk, which is the thing that confused me.

2 Likes

if you dont get that url download file after below, check the adblocker.

urls = Array.from(document.querySelectorAll(’.rg_di .rg_meta’)).map(el=>JSON.parse(el.textContent).ou);
window.open(‘data:text/csv;charset=utf-8,’ + escape(urls.join(’\n’)));

4 Likes

That’s the pretrained models. Here during inference, you’ll load your own model.

2 Likes

learn.be_patient()

19 Likes

I am interested, what is the right practice in fastiai, to load a set videos and sample e.g. every 3 second, to from a bunch series of images. So that I can apply Resnet34 (time-distributed) on each image and apply an LSTM on the next layer, for building a video classifier?

1 Like

For unbalanced data: What do you do if the class you care most about is a rare class. An example is identifying skin lesions where the most common benign class is way more frequent than melanoma?

2 Likes

This might be a slightly advanced thing, better to ask there, also there’s some discussion spread around here.

1 Like

I think ideally, we would have to balance the main data set we started with, shuffle the balanced data set and then get some validation/test sets out of the shuffled data set (instead of trying to balance only the train or validation set separately). That’s what I think intuitively - some expert can correct me if I am wrong.

Other than viability of convergence, Why does learning rate affect “accuracy”? It is just the rate of learning! it should just affect the time to train?

Anyone understand what this is doing?

x = torch.ones(n,2) 
x[:,0].uniform_(-1.,1)
3 Likes

I guess if it’s too big, it will overshoot and completely miss the optima, thus affecting ‘accuracy’.

1 Like

You have the whole week to figure it out :wink:
pytorch doc is your best friend for this.

3 Likes

Dot product is not matrix multiplication. The former is defined for vectors and is a completely different operation from the matrix multiplication. Dot product can be represented as matrix multiplication though.

torch.ones(100,2) creates a 100x2 matrix and x[:,0].uniform(-1.,1) makes the values follow an uniform distribution between -1 and +1

2 Likes

yeah, thats what i meant by saying 2 different learning rates which will find the minima, which one to choose?

Creating matrix [n,2] of ones and replacing the first dimension with random numbers [-1,1]

A matrix multiplication is a lot of dot products, it’s not a completely different operation.

4 Likes