Lesson 1 In-Class Discussion ✅

What pytorch version are you using ?

1 Like

pytorch version is 0.3.1

Hello,

Here is a timeline of the video of the lesson 1 of yesterday (with the links to the corresponding parts in the video).

Welcome

Jeremy Howard

Notebook 1
(https://github.com/fastai/course-v3/blob/master/nbs/dl1/lesson1-pets.ipynb)

  • Step 2: create the model (https://www.youtube.com/watch?v=7hX8yKCX6xM&t=5274)
    – creation of the learn model which contains the neural network architecture and the databunch dataset (we can add the error evaluation metric on the val set as argument if we want)
    – Learning Transfer: we use the parameters of a model already trained to recognize objects in images (resnet34)
    – Overfitting: to check that during his training our model does not specialize on the train set but learns well to recognize the general characteristics of the objects to detect, we use a val set on which we calculate the error (see metric above) in the learn model
  • Step 3: train the model with the fit_one_cycle() method and not fit() as in the previous version of the course (explication of the Leslie Smith paper in the article of @sgugger : The 1cycle policy)

After the break: https://www.youtube.com/watch?v=7hX8yKCX6xM&t=6536

  • Step 4: analyze the predictions made by the model to understand how it works and possibly improve it (https://www.youtube.com/watch?v=7hX8yKCX6xM&t=7922)
    – use of the interp object instantiated by the ClassificationInterpretation.from_learner (learn) method
    – 3 methods to use on the interp object:
    plot_top_losse() to view the images on which the model generates a big error (loss),
    plot_confusion_matrix() which displays the Matrix Confusion,
    most_confused() which publishes the list of labels (classes) predicted with the greatest number of errors

  • Step 5: improve the model (https://www.youtube.com/watch?v=7hX8yKCX6xM&t=8310)
    – find the best Learning Rate with the lr_find() method and then recorder.plot() (to display the loss-vs-lr curve)
    – then use the unfreeze() method on the learn model in order to be able to train all the layers of the resnet34 network and not only those added at the end of the model in order to have an architecture capable of giving a probability for each of the 37 classes … BUT using different Learning Rate according to the layers via learn.fit_one_cycle(2, max_lr=slice(1e-6,1e-4)): the idea is that the first layers do not need to be much modified because they have already been trained to detect simple geometric shapes that are found in all images.

  • Step 6: we can still get a better result (a lower error) by changing the model and using a more complicated (deeper) model like resnet50 (https://www.youtube.com/watch?v=7hX8yKCX6xM&t=9018)

31 Likes

Thank you @willismar !
Pip wasn’t updating the latest version of pytorch for some reason so I runned this command:
conda install pytorch torchvision -c pytorch
and now it is working! Current version 0.4.1.post2

2 Likes

@paul

I am very interested.

Please start one.

I use code from this repository:

3 Likes

How did you fixed this issue?

Look at this thread for more options:

Is there a preferred way for updating the dev version? I made a bash script that just runs:

git pull
tools/run-after-git-clone
pip install -e .[dev]

I was going to submit a PR, but haven’t found how to upload a file with executable permissions to github. On second look, a script like this would work well with the code in fastai/tools/run-after-git-clone

@rachel
here is a question:

preface:

I have a image dataset bus-truck (two classes “bus” and “truck(semi)” ) 32 images in train and 16 images in valid for each class.

resnet34 gives a training results as 0.06 error rate
resnet50 gives about the same

Question:
Is this a case of “horses for courses”? given the dataset (the course) resnet34(horse) is as good as it can get?
There is no benefit in moving to resnet50 given the dataset?

1 Like

If you have a dev install, you only need to update the directory with git pull to get the latest.

1 Like

Another reminder: do not use this thread to request setup help. I’m deleting all posts that do so. Use the platform-specific topics (linked in top post).

1 Like

Is there a recommended architecture for top-down images versus side-on? Or is resnet34 adequate for that too?

rn34 is great for both.

Hi I’m getting this error :

AttributeError: module ‘fastai.vision.models’ has no attribute ‘resnet34’

import fastai
fastai.__version__ gives
‘1.0.6’
import torch
torch.__version__ gives
‘1.0.0.dev20181020’

all above cells are running smoothly. How can I solve this problem?

1 Like

Please do not use this thread for setup questions.

Note that minimum prereqs are: pytorch v1. fastai v1.0.11.

1 Like

Sorry. noted.

Sorry, missed this during the lecture. Thanks, that makes a whole lot more sense. I’m assuming the mean/stdev transform is stored and then applied on the fly at test time on unseen images?

Yes, the same mean and std as computed on the training set.

how do you get the credit? I don’t see anything in my account, do you?