Image Classification — Fast.ai Practical deep learning for coders — Lesson 01

Rabbia T. Ahmed
4 min readJan 7, 2023
Photo by DeepMind on Unsplash

Disclaimer “All the material used in this belongs to Fast.ai and its Founders. As a student of the course, I did my practice using the code that they provided. Links to all their resources are available in the article. I used the code to design my own model and made it public on Kaggle, link is also available. I do not owe any right to their material other than the code I did for my own model building.

The course is straight to the point and personally, I don’t think you need much knowledge to start it. A number of prerequisites you need to learn are

  • Basic Python.

→ Get some practice in python and familiarize yourself with its syntax, libraries, and IDE (Google Colab or Jupyter Notebook).

  • Know-how of what is Machine Learning (ML) and Deep Learning (DL). Watch a few videos here are some suggestions.

→Machine Learning Basics | What Is Machine Learning? | Introduction To Machine Learning | Simplilearn

→Deep Learning In 5 Minutes | What Is Deep Learning? | Deep Learning Explained Simply | Simplilearn

  • Kaggle

→ Create an account on Kaggle and look around. Or get an overview of how it works through a video or blog.

Let’s talk about the course now Jeremy Howard totally had me sold within the first 10 minutes with a quick demo on creating an image classifier. It was so easy that I actually started crying.

The second thing he talked about was why we should listen to/take his course. I have to say he’s on point with everything. If you do not know yet, Jeremy Howard and Rachel Thomas Co-founders of fast.ai created the fastai library on the top of PyTorch. Its publicly available and used in a variety of DL tasks, especially Computer Vision. You can read and watch more about it on their website and first lesson.

Multiple things were implemented in the first lesson but I have only done one so far, Image Classification.

You can check Jeremy’s original code on his Kaggle Account. You can copy and edit by clicking the copy/edit black-colored button on the right-top corner.

A little description about the code; it is called Is it a bird? Creating a model from your own data. It searches downloads, and trains model on birds and forest pictures and is deployed to see if it classifies the input as the correct label.

I changed the code and train the model on 4 different pieces of furniture (chair, table, bed, and sofa). The code is pretty much the same. I just added extra comments for my own learning.

For the original code and its description checkout Jermey Howards Notebook. My edited notebook is avaibale here.

Downloading the images and creating the datasets.

Directories/folders are created for each category using for loop

Faulty data is deleted

Creating Datablock for the model to train on. Dataloader loads the data block onto the model

Model Training

The model is tested on three different images

The label output was great but I’m still not sure of the probability score.

You can experiment yourself by changing the hyperparameters, input data sets, etc.

The key to any field in CS is practice. So don’t just study books and watch lectures, implement them as well.

Resources

Practical Deep Learning for Coders

Practical Deep Learning for Coders — Lesson 1

My Kaggle Code

--

--

Rabbia T. Ahmed

Machine Learning | Deep Learning | Natural Language Processing | Data Science | Python | Technical Writer