Cats and Dogs code notes

Hi all,

I have been going through the videos and the forums with the aim of finding out exactly what every line of code dose. In the process I have been adding notes to improve my understanding especially as we are learning many new tricks! :grin:. Most of the notes are on what we have covered so far and there are still a number of gaps that I am hoping to complete soon.

The process is helping me understand the code better so thought I would share in case anyone else might find this useful, on top of the notes provided by other fellow students.

Here is the pdf with notes: lesson1_notes.pdf (2.1 MB)


That’s quite innovative :slight_smile:

1 Like

These are really useful, Thanks!

1 Like

Thanks a lot… Very useful indeed :slight_smile:

1 Like

Well done. You just demonstrated a very effective learning method, setting up an example.

1 Like

Thank you @balnazzar :+1:

1 Like

Epicly useful, thanks Amrit, very generous of you!

1 Like

Hi. I just started deep learning course from I want to know whether fastai library support gpu or not. Thanks in advance.

You can discover that in two seconds by just searching “gpu” in the search box.

Hey guys, I tried using the steps outlined in lesson 1 to build an image classifier for minerals.
I have written my first medium post based on it, please check it out and comment on it, thanks

Hi Amit,

Can you please explain below line of code from same lesson 1. I am quite confused.

probs = np.exp(log_preds[:,1]) # pr(dog)

My Understanding:
Above command will apply exponential function on Dogs(1) predictions data, But not for Cats. In that case, below function how this works for cats.
probs variable will have data only related to dogs

def most_by_mask(mask, mult):
idxs = np.where(mask)[0]
return idxs[np.argsort(mult * probs[idxs])[:4]]

def most_by_correct(y, is_correct):
mult = -1 if (y==1)==is_correct else 1
return most_by_mask(((preds == data.val_y)==is_correct) & (data.val_y == y), mult)


plot_val_with_title(most_by_correct(0, True), “Most correct cats”)