How I published an app and model to classify 85 snake species (and how you can too)

Source: Deep Learning on Medium

How I published an app and model to classify 85 snake species (and how you can too)

From MOOC to reality, how you can become a practitioner and overcome any challenge during a project!

Why?

I had just finished my last MOOC and couldn’t stop wondering whether I was ready to start a project. I was frightened, scared, and lacked confidence. However, after weeks of contemplation, I bit the bullet and announced I’d create a simple image classification model.

Now here I am with an app officially available on the Play Store and a GitHub repo with its open-sourced code. I’d like to explain the hurdles I’ve faced and the lessons I’ve learnt overcoming them (in hopes it’ll help you out too)!

Cover image sourced from here

My Journey

  • Created my own dataset from Google Image search results
  • Started with the simplest linear regression model possible
  • Tried to use my own custom CNN
  • Switched to a FAR larger dataset
  • Took Stanford’s CS231n to strengthen my foundations (theoretical knowledge)
  • Created the basic code to train a MobileNetV2 model
  • Learnt about Super Convergence (article about Super Convergence with PURE PyTorch coming soon…)
  • Created an Android app for Snaked which could take and import photos, before outputting the snake species

In short, I made a LOT of mistakes, and that’s precisely how I learnt. Google scrapping for images allowed me to appreciate the effort involved in creating a dataset with 120, 000 images. Starting with linear regression was a grand, stupid and hilarious blunder, but it taught me the value of CNN’s and pre-trained models first hand. Trying linear regression for such a task also forced me to find out how and why neural networks work! The long training times and mediocre results from a plain pre-trained model caused me to find Super Convergence!

My mistakes were like stages, without each and every one of them I wouldn’t have learnt anywhere near the amount I did

The benefits

An obvious question is why bother overcoming hurdle after hurdle when a free MOOC can teach the same content (maybe even taking less time and effort). I’ve already answered the question, but in short, it comes down to:

You remember information which you repeatedly use, and progressively forget all else

Now, this doesn’t mean you don’t go through any MOOC’s/tutorials, but just make sure you don’t get “stuck in tutorial hell”! Instead, if you know the basics apply the stuff you’ve learnt right now to create a cool, interesting project you can show of!

Challenges I overcame

Should I start now?

The fact you’re questioning your current skill, knowledge and theoretical foundation level indicates that you’re aware of the limits of your understanding! This doesn’t mean that you’re stupid, or not ready, but instead, you’ve learnt enough to know that there’s way more ahead of you.

Just understand that there will always be more to learn, so may as well start using what you already know

Is my idea good enough?

Two things you can do to judge:

  • Is my idea too simple/complex?
  • Ask someone else

If you’re unsure how complex the project will be, consider how others have faired on similar tasks. One way to find out is to search for online articles or research papers. If you find hundreds then the problem is probably too simple, but if you only find a few it’s probably unrealistic (or you’ve got a genius idea). Knowledge on the topic at hand is a must, so just research the topic and see what you find out!

If you don’t already have any connections to data scientists, then you’re going to have to reach out (like I did)! I’d do this ASAP no matter what, as it’s always incredibly useful to have a variety of opinions on any situation. My personal method is to reach out to data scientists near me saying I’m studying machine learning and looking for some advice. Most people reject, but if you put enough out it still works!

What if it fails?

Find out WHY your project can’t work!

If finding out why an idea can’t work doesn’t unravel another solution, then you’ve found out something new… and that’s an accomplishment!

I don’t know what to do!

Find similar problems to the one you’re trying to solve. For me, I started with tutorials on how to use PyTorch to classify digits (MNIST) and more complex objects (CIFAR100). I followed the tutorials and figured out how they achieved their task. I then used transfer learning, replicating what each tutorial had done, but this time for my own problem.

Of course, I was far from ready to tackle the full challenge but with time I figured out more and more.

If you’re still stuck though, you may actually need to go back to the books (or courses).

Nothing is working!

Just stick at it and after a while, something will click! At the beginning of creating my first model, none of my code ran, but eventually (after a few days), I managed to find the bug and fix it. Know I get how to run training and evaluation loops with PyTorch! Note that it’s often a small minor change which finally revives the code (so play around, debug a lot and you’ll figure it out).

I don’t understand how everything works?

Theory can be difficult. You can have a working model, but not know anything about how the transfer learning model, optimizer, loss function… or something else you’ve used works. But how long does it take to train the model… hours, days, weeks? If you can write the code, do that, run it and just learn the theory whilst it’s working. Your both training then (pun intended)!

It works, but how can I improve it?

I’ve got a blog post specifically on how to improve your model. Take a look once you’ve got a working model!

What do I do after creating a decent model?

This is the cycle:

Learn, create, improve, show off, rinse and repeat!

Just create blogs, create projects and continue through that cycle.

THANKS FOR READING!

Now that you’ve heard me ramble, I’d like to thank you for taking the time to read through my blog (or skipping to the end).
If this has helped you out consider checking out how to choose a model!