36

Introduction to Fast.ai

 5 years ago
source link: https://www.tuicool.com/articles/hit/bE7JBni
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

6BjMFrf.png!web

I wanted to be good at Artificial Intelligence (AI), specially in deep learning and machine learning, as it is something important in a developer's toolbox. In the last couple of years, I followed a few popular AI courses from Andrew Ng , Coursera and Udacity.

However, I never finished those courses because I lost interest. I don't blame those courses per se, but for me the problem lay with how the courses were organized; they introduced a lot of math or very complex code right from the beginning.

So... I'm still not good at AI.

Then something called fast.ai changed my perception of AI.

This is a beginner's introduction to fast.ai. If you are an expert in this field, I think you can ignore the rest of this blog post. :D

What is fast.ai?

If you visit the fast.ai website, you'd think it's just another blog. If you hopover to their MOOC , you'd think it just looks like a set of videos recorded in some university classroom. If you check fast.ai' s GitHub repository, you'd definitely ask, "What the hell is this?"

Yet despite what it looks like, what's behind fast.ai is very interesting.

It is a research lab started by two people , one a former President of Kaggle and the other a well known expert in AI. Their mission is to make AI accessible for all.

Ez2qQvM.jpg!web

Jeremy Howard and Rachel Thomas, founders of fast.ai

fast.ai can be described as a research lab bundled with courses, an easy-to-use Python library with a huge community. Their library wraps popular deep learning and machine learning libraries for common workflows and provides a user-friendly interface.

Most importantly, it follows the "top down" approach.

"Top down" is exactly like how we learn a sport. We start by trying to play it, without worrying about rules. Once we are confident, we learn the rules and tricks one by one.

Similarly, fast.ai allows us to build a model using only a few lines of code. After that, we can improve it further. For example, have a look at the following code:

PATH = 'location/to/images/to/train'
arch = resnet34
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True)
learn.fit(0.01, 3)

Using this code, I build an image classifier which could detect elephants and lions with 95% accuracy.

F7z6ZnZ.png!web

Validating the above model with some random images

Computing Resources

In order to follow these courses, you would definitely need to use a GPU from Nvidia. Unless you own a gaming PC, it is unlikely that you have a Nvidia GPU. Even if you have a Nvidia GPU, you may need to download a lot of data from the internet to train models.

The best option is to use a Cloud GPU.

Here are some options for you:

Crestle

Crestle is the easiest option to get started with. It costs about US$0.60 per hour. You don't need to set anything up, just start learning.

Paperspace

Paperspace has a range of GPU options for you to choose from. The starter option is cheaper and more powerful than Crestle. The downside is that you would have to spend an hour or so to do the initial setup . It could be difficult if you don't have some Linux experience.

AWS and GCE

Both of these cloud providers have a wide range of GPU options and they could be more cost-efficient than Paperspace in the long run (especially by using spot instances). You could also utilize FREE sign up credits.

Google for "fastai aws" or "fastai GCE" to get started.

Google CoLab

With Google CoLab , you can get a GPU for FREE. As it's mainly built for Tensorflow (Google's deep learning toolkit), running fast.ai on CoLab is challenging. If you have time to experiment, you could try making it work for fast.ai.

I use Paperspace since it is the middle ground between Crestle and AWS. It costs around 0.50 USD an hour for the GPU usage.

I think most of us can spare 1 USD per day to learn something really useful for 2 hours.

Fastai version 1.0

fast.ai recently released version 1.0 of the library with a lot of improvements. However, there are no tutorials or guides to use it, unless you are already familiar with fast.ai and how it works.

Fortunately, the team is starting a live course for fastai 1.0 on October 22nd. Unfortunately, enrollment in the course is now closed.

After October 22nd, you can expect to see tutorials on how to use the fastai library v1. I'm also planning to write a series of blog posts as I'm taking the course.

Everyone will be able to access this new course early next year. But please don't wait, visit http://course.fast.ai and start learning today.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK