I think I have wikified the post now (hopefully) Everyone, let us work our magic
Hi @radek I was going to summarise the lecture + Things Jeremy says to do (and then convert that into a podcast) today.
Youāve already done 70% of it, is it okay, if I add the remainder to the OP-it might be slightly off of the theme so I asked before doing it
Thank you! Very useful to get started with this adventure.
Mhmm mhmm mhmmā¦ Iām thinking it would be good to keep this specific to the homework, especially as for many it will be the first homework in the course and potentially their introduction to this way of learning.
That also means that if anyone has any homework related questions, it would be great to discuss them in this thread
If it is on the homework, then sure, add it here If it is more of a summary of valuable thoughts on learning / doing machine learning, then it might be better to put it in the main https://forums.fast.ai/t/lesson-1-official-topic/65626 under notes. But you have all the info, not me, so you decide
BTW what happened to the awesome Share your work here ā from v3? This thread added a lot of value and was a nice place for people to casually post what they have been working on even if it was just a short blog post they posted on some tiny notebook on github? People did a bunch of awesome things and seems we donāt have such a place in this version? Should we create it?
I have been thinking of doing a summary of the lecture and I think it might go into such a thread, that might be a good place for all those little wonderful things and also it was such a popular thread people kept on checking it religiously. If you add your podcast to the wiki here there will be no notification I believe so there is a great chance many people who would be interested will miss it!
We have this very nice thread, but its more of people discussing what they will do in the future and while such conversations can be interesting, we need a separate thread where people could come in and share their work that has been completed Would be awesome for instance to see notebooks on github from people running lesson 1 code but on datasets of their choice / creation.
Anyhow - great question Sanyam I am also starting to feel this course is yet again by an order of magnitude larger than the previous iteration, with so many active new people (and I am sure there will be even more joining the activity on the forums in days to come ), its definitely important for us to give thought where we put things. Kudos for bringing this up.
Thanks @radek for starting this thread! Such a wonderful thought to start a homework thread
Because, you have started this thread I think it would be brilliant to keep this thread going week on week as a central repository to mention homework and discuss homework related questions.
I am sure this can thread can be used to share the work already completed as well. Did not mean to keep it āfuture work onlyā
I did end up updating the thread and information a little https://forums.fast.ai/t/share-your-v2-projects-here/65757 so we can use the same thread to share completed/future work. IMHO it would be verbose to have two threads - one for future and one for current work.
If you are struggling or want to check your answers, check out my post here! (almost done, will update the remaining question solutions in a few hours)
Also, there may be errors or alternative answers, so feel free to reply with your thoughts or edit the wiki!
Thanks, I was worried I was behind when people posted questions beyond 01_intro. Do we have deliverables when we finish chapter 1, or are we just required to learn the material and be able to run the code?
The homework is not checked or anything like this. Anything we do in this course is just for us - meaning you should do whatever you feel is helping you learn
Part of what seems to work very well (as Jeremy suggests in the lecture) is running code, seeing how things change with changes to inputs, checking out the docs, playing our with jupyter notebook -> getting acquainted with the whole ecosystem.
This thread is about giving people a bit of a helping hand with what they can do for the first lecture to get going, but generally you can come up with anything you feel would help you learn (running the code on your own data or some other dataset - maybe even one built into fast.ai, this links to fastai v1 though, writing a post on the forum explaining something, asking a question, writing a blog post, creating a NB on something that interests you, pushing to github and sharing on the forums, etc).
I am not sure if itās part of the top-down way of learning (didnāt read the book) but in the way the fast.ai courses play out, you control your destiny, or what you get from the course! Sounds very similar to life in that regard
This is gold.
Hi Radek,
Where can I find information on how to do this:
- see if you can grab the fast.ai documentation notebooks and try running them
hi @radek and fellow members, can someone please update the Did YOU do the homework? with this weekās homework and topics that we can study ourselves that will be suitable for the course.
@0tist Please donāt hesitate to do it yourself, Weāre all here to learn even though our speeds vary since we started our āwalks with fastaiā at different points in time, but the great thing is weāre here.
Most of the times someone on the forums start something and many people follow. Radek might say this is similar to how it happens in life
hi @0tist just added things from lecture2 that can be interpreted as homework in my perspective & thanks @radek for starting this thread, it has really helped me
Regarding the instruction to read and understand the #Click me cell of Chapter 1, these are my thoughts and questions. As will be obvious, Iām a novice programmer.
from fastai2.vision.all import *
Import everything (classes, libraries, etc.) from the fastai vision library
path = untar_data(URLs.PETS)/'images'
I had a misunderstanding about this one. I thought untar_data(URLs.PETS)
was downloading the URLs of the pet images, possibly because Iām predisposed to think of downloading URLs for the classifier for Lesson 1 from v3, but also because itās URLs plural, not URL. So I checked the docs, and it turns out thereās a URLs
class weāre using, and PETS
is one of its methods. There are similar URLs
methods for other datasets, but only the fastai ones. This approach doesnāt generalize to non-fastai datasets (but weāll be learning other approaches that do generalize!).
So the dataset is extracted, and the location of the extracted dataset is returned to path
. But what does the /'images'
at the end do? I searched the forum and found the notes from Lesson 3 of v3, and if Iām extrapolating correctly, I think the pets dataset has a folder named āimagesā, and weāre telling the path to point specifically to that folder, rather than to the dataset folder as a whole. Is that right?
def is_cat(x): return x[0].isupper()
Define a function is_cat
to which we pass x
, the filename of each pet image. A characteristic of this particular dataset is that the first character of the filename is uppercase if the file is an image of a cat, so is_cat
returns True
if the first character of x
is uppercase, and False
otherwise.
dls = ImageDataLoaders.from_name_func(
path, get_image_files(path), valid_pct=0.2, seed=42,
label_func=is_cat, item_tfms=Resize(224))
I have questions about this one, too. The book says:
" The fourth line tells fastai what kind of dataset we have, and how it is structured. There are various different classes for different kinds of deep learning dataset and problemāhere weāre using
ImageDataLoaders
. The first part of the class name will generally be the type of data you have, such as image, or text. The second part will generally be the type of problem you are solving, such as classification, or regression."
What is āthe second part of the class nameā that is āthe type of problem you are solvingā¦ā? Weāre doing classification, but itās not obvious to me where thatās declared in the class name.
Then weāre using the from_name_func
method of the ImageDataLoaders
class, which creates our DataLoaders
(dls
as weāre calling them here), setting aside 20% of our data as the validation set, setting the optional seed value to 42, setting the labelling function to be our is_cat
function defined above, and selecting the Resize(224)
as the transformation to be applied to the images, resizing them all to 224x244 pixels for historical reasons.
But why is the seed set to 42? The book and the docs say itās for reproducibility, and I understand that getting the same validation set every time is what gives us reproducible results, but what is a seed, and how does it achieve a reproducible validation set? I Googled āreproducibility seedā and found this post helpful:
āThe āseedā is a starting point for the sequence and the guarantee is that if you start from the same seed you will get the same sequence of numbers.ā
But if the elements of the validation set are chosen randomly, how does starting from the same point help? And why 42? Is there a practical consideration at work, or is it just Douglas Adams?
learn = cnn_learner(dls, resnet34, metrics=error_rate)
Use the cnn (convolution neural network) learner, telling it to use the dls
we established above, the ResNet34 architecture, and the error rate as a metric. Pretty straightforward for me.
learn.fine_tune(1)
Since weāre using a pretrained model, we donāt want to start fitting the model from scratch, as we would if we used learn.fit
. Instead, weāll fine-tune the model for our particular dataset for one epoch (a complete pass through the dataset) to create the head of our model, which is unique to this dataset. The book says:
āAfter calling
fit
, the results after each epoch are printed, showing the epoch number, the training and validation set losses (the āmeasure of performanceā used for training the model), and any metrics youāve requested (error rate, in this case).ā
But it must mean āAfter calling fine_tune
.ā
I did have another hiccup, trying to use ??
to see the docs for methods, e.g. ??cnn_learner
; I keep getting an error āObject cnn_learner
not found.ā Other shortcuts such as b
to create a new cell are working for me, so Iām not sure what Iām doing wrong with this one.
And thatās the lot! Thanks for reading all of this, and please let me know if you can answer any of my questions, or if Iāve mischaracterized anything.
This is a good question. Setting the random seed to the same value guarantees that every time you run your model it will generate and consume exactly the same stream of random numbers, and therefore will get the same results. This is useful because when you are modifying or debugging the code, you can always compare your results against a baseline (the results with this random number seed) to check that you havenāt inadvertently changed anything.
Thanks very much! I think my problem was naivetĆ©: I was too willing to believe in the true randomness of the numbers chosen, which isnāt possible.
Iām still not completely clear on why weāre seeding with 42 in particular, but Iām just going to assume itās because itās the answer to life, the universe, and everything unless told otherwise.
Of course thatās why itās 42
! Trust your intuition on that one.