Cats and Dogs code notes


(Amrit ) #1

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)


Understanding cycle_len and cycle_mult
Lesson1.ipynb(lecture -1) doubts
Deep Learning Brasília - Lição 1
Deep Learning Brasília - Lição 1
(Anand Saha) #2

That’s quite innovative :slight_smile:


(Vitaly Bushaev) #3

These are really useful, Thanks!


(Dipjyoti Bisharad) #4

Thanks a lot… Very useful indeed :slight_smile:


(Andrea de Luca) #5

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


(Amrit ) #6

Thank you @balnazzar :+1:


(Julian Harris) #7

Epicly useful, thanks Amrit, very generous of you!


(ArunDas) #8

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


(Andrea de Luca) #9

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


(Kofi Asiedu Brempong) #10

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


(Sai krishna yalamanchili) #11

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]
print(mult*probs[idxs])
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”)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++