Intro to Fast.Ai

fastai
Author

Oshan Modi

Published

May 13, 2023

A summary of the first lesson of the fastai v1 course.

fast.ai

fast.ai is an API built on top of pytorch that provides easy implementation of machine learning functions for most practical usecases, without having to worry about any of the boilerplate code. Not just that, it also enables customisations in all the right places.

This is my one of many attempts at completing the fastai course. I have been at it since the first iteration of the course, back in 2016.

In this blogpost we talk about the contents of the first lesson of the course.

In the first lesson Jeremy explains the steps involved in training an image classifier using the datablock api. datablocks are building blocks for model development in the fastai universe and come with several inbuilt methods that expedite model training and exploration.

Steps to train an image classifer using datablock and resnet18 architecture:

  1. Create a datablock api
  2. Pass the path of the data to dataloaders method of the datablock
  3. Create learner with resnet18 architecture and the dataloader created in step2
  4. fine_tune the learner
  5. export learner as pickle for inferencing.

Let’s understand the inputs to the datablock api -

  1. datatype - input object type, label type
  2. function to identify the label
  3. item transformations
  4. batch transformations
  5. splitter - function to split to training and validation datasets
  6. get_items - function to obtain the input objects

There are task specific dataloaders built on top of datablocks which further simply data load, eg. Segmentation dataloaders, Tabular dataloader, collab dataloaders, and more.