fast.ai: How I built a deep learning application to detect invasive species in just 1 day (and for $12.60)

Jeremy Howard’s fast.ai course is deep learning for results-oriented people

Kevin Dewalt
Actionable AI
5 min readMay 17, 2017

--

I’ve read dozens of books and taken many classes on machine learning. fast.ai is, by far, the most practical way to get started with deep learning. In this post I’ll share my experience after completing the first 2 lessons.

Trust me — starting with math is a bad way to learn AI

22 years ago I sat in Bernie Widrow’s Neural Networks class at Stanford and watched the father of the digital filter painstakingly explain proofs of stochastic gradient descent.

After 2 quarters of theory I still couldn’t make a neural network — I only learned how to build one by playing with MatLab. I finally understood gradient descent only when I needed to write the code to train my network weights.

Unfortunately not a lot has changed. Most practicing machine learning engineers come from a academic background; when asked, “how can I start learning AI?” by professional programmers, most will refer them math-heavy sources like the Deep Learning book (happens).

Ian Goodfellow’s book is a great reference book for researchers but hardly a practical first step for most of us. The chapter on gradient descent gave me flashbacks of life as a graduate student:

A page from Deep Learning by Goodfellow et al on gradient descent. A great research reference but not a practical starting point for professional programmers.I read 2/3 of the book over the Xmas holidays and still couldn’t build a neural network.

Understanding theory is essential for research roles or advancing the cutting-edge of AI. For for most AI business applications the math is a huge distraction.

Why? Because businesses have more critical challenges like selecting the right problems, organizing data, and deploying solutions. These market and execution risks force professional programmers to build applications using proven techniques — and thus knowing how to implement a solution is more important than knowing why it works.

I can’t “learn” a new skill by reading about it. I have to use it.

I know only one way to learn a new technical skill: by building something with it. Deep learning is no different and Jeremy Howard’s fast.ai course is the fastest way to learn AI by building.

fast.ai is a hands-on way to learn deep learning

Course co-founders and Jeremy Howard and Rachel Thomas deliver on their promise of “making the power of deep learning accessible to all”.

Rather than describe the course I’ll refer you to the course testimonials and share my own early experiences.

Why I decided to take the course

I started with a decent theoretical understanding of deep learning and practical knowledge of what it can do. I’m taking the course to get more hands-on experience.

Building simple solutions helps me plan projects, hire, and make engineering tradeoffs more effectively — critical skills for any leader.

But most of all I just wanted to connect theory and practice by building simple deep learning solutions.

How I built an algorithm to detect invasive species

How far can I get on a Saturday?

After finishing the first 2 lessons I decided to enter a Kaggle contest.

My goals were:

  • To break into the top 50% of entries by the end of the day.
  • To write every line of code myself without cut-and-paste.
  • To understand all referenced libraries and APIs.

I picked the Invasive Species Monitoring playground competition. It is a relatively simple classification problem and a good starting point.

Plus it just sounded fun.

Pictures of invasive hydrangea from the Invasive Species Monitoring Kaggle competition. The challenge is to develop algorithms for identifying whether images of forests and foliage contain invasive hydrangea.

I started at 7am with a pot of coffee and fired up my GPU on Amazon AWS. By 9pm my eyes hurt, the cats were screaming for food and my brain was fried.

I decided I submitted my results to Kaggle and let the chips fall…

My code

Here is my complete notebook on github which documents the 7 steps of my work plan.

Don’t be impressed by the code — I simply followed a similar approach taught in the class. Any programmer with at least 1 year of experience should have no problem duplicating my results.

90% of my day was learning libraries, organizing data, and evaluating results — simple stuff unrelated to deep learning.

Validation results

I trained my algorithm on 90% of the images and used the remaining 10% to validate the results.

Prediction accuracy

I achieved a prediction accuracy of 91%. Here is the confusion matrix:

The confusion matrix shows how well my algorithm worked on the validation set. Biggest area for improvement is in false negatives — the 12 instances where the algorithm incorrectly identified the invasive species. You can see the results below.

How good is 91%? Just 3 years ago state of the art in computer vision was 80%! I beat it on my very first try.

Correctly identified images had flowers in them

I reviewed images the algorithm correctly identified. The big blue hydrangea flowers seem to be the key features.

Some incorrectly identified images had obvious problems

The algorithm incorrectly identified 18 images. I see areas for improving the algorithm.

The false negatives seem to be small flowers which were not correctly identified. I think cropping the photos to generate more labeled examples should improve my results.

Victory! I made the top 50%!

With my first attempt I ranked 21st out of 52 entries putting me into the top 50%.

Goal achieved!

I made it into the top 50% of entries in a single day.

I have many ideas for improving my results but I’m not sure I’ll continue working on it. I achieved my objectives and learned what I need to know.

Sometimes better is the enemy of good enough.

Is fast.ai for you?

If your goal is joining the open.ai team or winning the ImageNet contest then fast.ai won’t take you very far. Enjoy your partial derivatives, I wish you the best.

But for the rest of us …

  • Team leaders who want a practical introduction to the basics.
  • Professional programmers looking for a practical first step towards becoming a deep learning engineer.
  • Product managers who want to know how to develop an AI spec.
  • Anyone who wants to sort a ton of Lego.

… fast.ai is a great start.

--

--

Kevin Dewalt
Actionable AI

Founder of Prolego. Building the next generation of Enterprise AGI.