I had a breakthrough that turned a Deep Learning problem on its head!

Here is the story.
Here is the lesson I learned.

πŸ§΅πŸ‘‡
No, I did not cure cancer.

This story is about a classification problem β€”specifically, computer vision.

I get images, and I need to determine the objects represented by them.

I have a ton of training data. I'm doing Deep Learning.

Life is good so far.

πŸ‘‡
I'm using transfer learning.

In this context, transfer learning consists of taking a model that was trained to identify other types of objects and leverage everything that it learned to make my problem easier.

This way I don't have to teach a model from scratch!

πŸ‘‡
I experimented with three different base models (all of them pre-trained on imagenet, which is a huge dataset):

▫️ResNet50
▫️InceptionV3
▫️NasNetLarge

I settled on NasNetLarge.

(Now I'm doing everything I can to move to any of the other two, but that's another story.)

πŸ‘‡
I also tried different architectures to extend that base model.

A couple of layers later and a few dozen experiments, the model started providing decent results.

Decent results aren't perfect results. But they were good enough.

πŸ‘‡
If you have tried this before, there's been nothing surprising or different in this story.

I should have stopped at this point. (But then I wouldn't have this tweet to write!)

I didn't because sometimes, you don't want to be known as the "good enough" guy.

πŸ‘‡
After a lot of tunning, I wasn't getting any substantial performance improvements so I decided to take some distance and look at the problem as a whole.

Users have a web interface to upload the images. These come as a set representing different angles of the object.

πŸ‘‡
It turns out that the web interface requests images in a specific order:

1. Front of the object
2. Back of the object
3. Other

Users aren't forced to upload images that way, but 99% of them do.

A front picture of the object is usually very useful. A side picture is not.

πŸ‘‡
Could I feed the order that these pictures were submitted as another feature to the model?

Would my Deep Learning model be able to pick up and use this information for better predictions?

πŸ‘‡
I changed the model to add a second input. Now, besides the photo, I have an integer value representing the order.

I retrained the whole thing.

And... yes, it worked!

The improvement was phenomenal: 10%+ higher accuracy!

πŸ‘‡
This is the end of a story that taught me an important lesson:

Open your mind. Look around. Think different.

Even more specific:

The magic is not in the architecture, the algorithm, or the parameters. The real magic is in you and your creativity.

Stay hungry!

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Santiago πŸŽƒ

Santiago πŸŽƒ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @svpino

12 Oct
When I heard about Duck Typing for the first time, I had to laugh.

But Python 🐍 has surprised me before, and this time was no exception.

This is another short thread 🧡 that will change the way you write code.

πŸ‘‡ Image
Here is the idea behind Duck Typing:

▫️If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck.

Taking this to Python's world, the functionality of an object is more important than its type. If the object quacks, then it's a duck.

πŸ‘‡ Image
Duck Typing is possible in dynamic languages (Hello, JavaScript fans πŸ‘‹!)

Look at the attached example. Notice how "Playground" doesn't care about the specific type of the supplied item. Instead, it assumes that the item supports the bounce() method.

πŸ‘‡ Image
Read 8 tweets
11 Oct
This is ridiculous.

I've been coding in Python 🐍 since 2014. Somehow I've always resisted embracing one of their most important principles.

This is a short thread 🧡about idiomatic Python.

πŸ‘‡ Image
Python is all about readability.

One of its core principles is around writing explicit code.

Explicitness is about making your intentions clear.

Take a look at the attached code. It's one of those classic examples showing bad versus good.

See the difference?

πŸ‘‡ Image
There are more subtle ways in which Python encourages explicitness.

This example shows a function that checks whether two keys exist in a dictionary and adds them up if they do.

If one of the keys doesn't exist, the function returns None.

Nothing wrong here, right?

πŸ‘‡ Image
Read 9 tweets
8 Oct
Here is a formula for growth.

(Not the only one, but one that works.)

People follow you when they are afraid of missing out on what you have to say.

People get afraid of missing out when they meet you and have a chance to realize that they want more of you.

πŸ§΅πŸ‘‡ Image
Then, we can conclude that there are two steps:

1. You need to get in front of people by posting "shareable" content.

2. Once people meet you, you need to hook them so they follow you instead of moving on.

πŸ‘‡
In Twitter, shareable content means content that people want to engage with:

▫️They like it
▫️They leave a comment
▫️They retweet it

There are multiple ways to create shareable content that spreads quickly.

πŸ‘‡
Read 10 tweets
8 Oct
A real-life Machine Learning solution that works.

Here is a breakdown of every piece and how they work together.

πŸ§΅πŸ‘‡
There's a website.

Users upload a group of pictures of an item and select the category it belongs to.

The system returns how much money the item is worth.

πŸ‘‡
Before:

▫️A group of people reviewed the pictures submitted by the user and decided how much the item was worth.

Today:

▫️The system quotes some of the items automatically (some still have to go through humans for a quote.)

πŸ‘‡
Read 11 tweets
7 Oct
Want to hear a secret?

Regardless of your experience, here is an area of Machine Learning where you can have a huge impact:

▫️ Feature Engineering ▫️

It sounds fancy because people love to complicate things, but let's make it simple: πŸ§΅πŸ‘‡
In Machine Learning we deal with a lot of data.

Let's assume we are working with the information of the passengers of the Titanic.

Look at the picture here. That's what our data looks like.

The goal is to create a model that determines whether a passenger survived.

πŸ‘‡
Each one of the columns of our dataset is a "feature."

A Machine Learning algorithm will use these "features" to produce results.

"Feature engineering" is the process that decides which of these features are useful, comes up with new features, or changes the existing ones.

πŸ‘‡
Read 14 tweets
6 Oct
I don't have proof, but I have empirical evidence that this is true:

▫️The outcome of a pair programming session is directly proportional to each developer's capacity to challenge each other.

Let me explain: πŸ§΅πŸ‘‡
If you pair 2 developers with very different seniority levels, the session will become more of a training opportunity for the least senior person.

The short-term impact on the project will be negligible. Most of the ideas and progress will come from the senior person.

πŸ‘‡
If you pair two developers with a similar experience, their contributions multiply, giving you a much larger short-term impact.

You aren't getting ideas from one or the other anymore. You are getting a polished version that's better than any idea individually.

πŸ‘‡
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!