-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lesson 1: Image classification #19
Comments
Some info on GPUsBy Rachel Thomas Things noticeably changed so far on the fastai experience compared with the previous versionThe interface for the lessons has a pythonic feel to it, like geopandas, with the blue vertical bar on the left for index. Introductions 0-10minswhy fastai etc Lesson-1 Pets (10mins - 47mins)Always start a jupyter notebook with these three lines of code:
the % is special directives to jupyter notebooks. If someone changes the code while running, reload. If someone plots something, plot it in Jupyter notebook. PyTorch is one of the most popular libraries in the world. More modern than Tensorflow. Fastai library sits on top of PyTorch to do things faster and easily. Looking at the Oxford-IIIT Pet Dataset, an academic dataset and interestingly in 2012 gained an accuracy of 59.21%. Now let's find out how accurate we can learn to differentiate between the 37 distinct categories of dog and cat breeds. No longer looking at a binary classification, dog vs cats problem, is now too easy. The models are doing so well and getting everything right. untar data function, pass in a URL which will download and extract the data! So lets get the data we need to build the model using the ImageDataBunch object. This object will contain two or three datasets: train, validation and test data. The size of the images is important, a GPU has to apply the same instruction to a whole bunch of things/images at the same time. As a result all the images have to be the same size. 224x224 is a very common size for machine learning models. And this will do something called centre cropping, but data augmentation can change this. Normalization means that you will have the same standard deviation. The pixel values will start out from 0-255, so the channels (commonly RGB) will have a mean of 0 and standard deviation of 1. Let's look at the data: Let's look at the data classes: Train the model using resnet34. resnet34 will train faster than resnet50. Start with the smaller one and see if it is good enough. The Downloading shows that resnet is a pretrained model based on ImageNet, and it will already know a lot about what pets look like. Now time to fit the model. Lessons learnt from previous fastai courses (47min - 1hr:07mins)The basic feedback is that the code needs to be run, run run run the code. Natural Language Semantic Code Search in GitHub is using the fastai library. "Pick one project, do it really well, make it fantastic!" Jeremy HowardCombine your domain/professional knowledge with the deep learning skills from the fastai course. Another great example is gendered facial recognition by a previous female student. Most AI researchers a white men, IBMs system is 99.8% accurate on white faced men, whereas it is 65% accurate on black faced women. An app for the blind which will tell you what it sees. The fastai algorithm was used on the ImageNet database in 18minutes using 16 AWS instances, at a total compute cost of around $40!!! Back to Lesson-1 Pets (1hr:07mins - 1hr:30mins)Save the model and its weights: ```learn.save('stage-1') Now what comes out of the model? Something to get really good at. Use this class for classification and interpretation, learn is the model: visualisation: plot top loss. How good is your prediction? the confusion matrix shows that the model was almost right all the time, so a confusion matrix won't always be that useful. Use the most confused function to grab the most confused classifications. The reason this CNN ran so quickly was that we only trained the last few layers. Now we want to go back and train the full model. Call unfreeze. So reload the model and find the learning rate the thing that ficture out the fastest I can train the model without making it zip off of the rails and fall apart. resnet50 is bigger than resnet34, so if you run out of memory this is normal. Another Dataset (1hr30mins -A guide is being created on how to download images from google images! How to create labels in lots of different ways with MNIST The documentation for fastai doesn't just tell you what to do it will tell you how to do it step by step. Questions(1hr06mins) Why resnet not another architecture? Wide ranging and wins a lot of competitions on Kaggle. (1hr37mins) Will the fastai library use multi GPU in parallel by default? It will with multi CPU, multi GPU may be covered in part two of the fastai course. (1hr38mins) Can the library use 3D data? Yes is can! Homework:Run the lesson-1 notebook and then get own dataset and make a notebook to do an image classification. |
Transferring files from Linux instances to local repoTransferring files using the gcloud command-line tool An error: The solution: Another error:
Tried on local and VM: To see the full GCP config for a project: Finally: helpful pages: |
close issue. |
The key outcome of this lesson is that we'll have trained an image classifier which can recognize pet breeds at state of the art accuracy. The key to this success is the use of transfer learning, which will be a key platform for much of this course. We'll also see how to analyze the model to understand its failure modes. In this case, we'll see that the places where the model is making mistakes is in the same areas that even breeding experts can make mistakes.
The text was updated successfully, but these errors were encountered: