Santiago Profile picture
12 Oct, 19 tweets, 4 min read
A big part of my work is to build computer vision models to recognize things.

It's usually ordinary stuff: An antenna, a fire extinguisher, a bag, a ladder.

Here is a trick I use to solve some of these problems.
The good news about having to recognize everyday objects:

There are a ton of pre-trained models that help with that. You can start with one of these models and get decent results out of the box.

This is important. I'll come back to it in a second.
Many of the use cases that I tackle are about "augmenting" the people who are working with machine learning.

Let's say you have a team looking at drone footage to find squirrels. Eight hours every day looking at images.

This sucks. I can help with that.
(By the way, I haven't done anything with "squirrels." It's just a silly example I'm using on this thread, so bear with me.)
One thing in common across many of these uses cases: You almost always prioritize recall.

Why is that?

The goal is to cut down the amount of work that people have to do. You want to make them more efficient, so you want to find interesting images for them to review.
Out of the bazillion images that a drone takes, we only care about those with squirrels in it.

We want to have a high recall finding squirrels. We don't care if that means sacrificing precision.
Here is a dream scenario:

We build a model that cuts down the amount of work people have to do by throwing away 90% of the images that don't have squirrels.

People can now focus only on 10% of the images!
As long as we are including anything that may be a squirrel in that 10%, we are good.

(90% - 10% are just hypothetical figures. Sometimes, even cutting 1% of the work is valuable.)
Remember I mentioned that there are a ton of pre-trained models good at recognizing everyday objects?

This is how I use them:
First, any good solution will use a specialized model (trained explicitly to recognize squirrels.) You can build this using transfer learning from a pre-trained model.

This is table-stakes.

But there's another excellent way to use pre-trained models:
You can use a pre-trained model out of the box to regulate the precision and recall of your solution.

In other words: an ensemble of models that votes for the final answer.

Here is how this works:
Let's imagine we use 2 models:

• Model A is the classifier you trained to recognize squirrels.

• Model B is a pre-trained ResNet50 model that knows some stuff about squirrels. It's not as good as Model A, but it's not dumb either.

Now you use both models with your images.
Do you want to increase recall?

If at least one model sees a squirrel, you report the image as being a positive sample.

Do you want to increase precision?

You only report a positive sample if every model sees a squirrel.
You can add more models to control your precision and recall better.

(In my experience, I've never gotten over three models. There are diminishing returns with this.)

The best part of this? You only train and worry about a single model and use everything else as it comes.
A great candidate to recognize everyday objects? OpenAI's CLIP.

Holy shit, CLIP is good!

Zero-shot. Don't need to spend a second training it, and it's excellent at helping your specialized model.
Do you know what's even better than this?

You build a *really*, *really* good model that recognizes squirrels and potentially takes over all the work people are doing.

Why would you focus on doing 90% of the work when you can do 100% of the work?
That's, unfortunately, how many people are still approaching machine learning.

I get it. That's what all of us want. But money and time are finite resources.

The trick is to take it one step at a time. There's a lot of value we can reach with out-of-the-box solutions.
Now, I wish I could get the opportunity to build a squirrel-detector model.

One thing is for sure: If I do, I'll tell you about my experience building it.

This is me → @svpino. Follow me because you don't want to miss it.

• • •

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

11 Oct
Last week I trained a machine learning model using 100% of the data.

Then I used the model to predict the labels on the same dataset I used to train it.

I'm not kidding. Hear me out: ↓
Does this sound crazy?

Yes.

Would I be losing my shit if I heard that somebody did this?

Yes.

So what's going on?
I have a dataset with a single numerical feature and a binary target.

I need to know the threshold that better separates the positive samples from the negative ones.

I don't want a model to make predictions; I just need to know the threshold.
Read 10 tweets
8 Oct
I get asked about machine learning all the time.

Here are my answers to some of these questions: ↓
Q: Where do I start?

Start by learning how to program.

Take your time. Usually, a solid year of Python experience will set you up for success.

Kaggle has a great introductory tutorial to get you started with Python.
Q: I already have plenty of Python experience. Now what?

For most people, I recommend the "Machine Learning Crash Course" created by Google or the "Intro to Machine Learning" from Kaggle.

If you are feeling adventurous, take "Machine Learning" from @AndrewYNg on Coursera.
Read 15 tweets
7 Oct
More data is usually not the way to turn around a mediocre machine learning model.

I've heard too many times that deep learning's silver bullet is throwing more data at a problem.

That hasn't been my experience.

Good Data is better than Big Data.
More data, even with a moderate amount of mislabeled examples, will hurt your model.
Assuming the data is good, then more data is probably not going to be a problem.

Unfortunately, the quality of data is usually inversely proportional to the amount of it. More data is often mediocre data.

But if your data is good, no harm.
Read 4 tweets
6 Oct
Which one do you prefer? The code on the left, or the code on the right?

I'd love to hear why. ImageImage
I always was a “left” kind of programmer.

For quite some time now I’ve been forcing myself to use the right style.

Look at “EAFP vs LBYL”. Pretty interesting arguments.

- LBYL - Look Before You Leap. (Left)

- EAFP - Easier to Ask for Forgiveness than Permission. (Right)
Also, I love all of you, but it’s usually a good practice to answer the question using one of the two options instead of going with a third, imaginary option that you feel is better for your imaginary problem.

😋
Read 5 tweets
1 Oct
A team led by MIT examined 10 of the most-cited datasets used to test machine learning systems.

They found that around 3.4% of the data was inaccurate or mislabeled.

Those are very popular datasets. How about yours?

I've worked with many datasets for image classification.

Unfortunately, mislabeled data is a common problem.

It is hard for people to consistently label visual concepts, especially when the answer is not apparent.
This is a big problem.

Basically, we are evaluating models with images of elephants, expecting them to get classified as "lions."

Your model can't perform well this way.
Read 12 tweets
30 Sep
Do you want more people to read your Twitter threads?

Here is something you can do.

I'm glad threads have become popular, and more people are publishing their content that way.

I've been experimenting with threads for a while. I've learned a ton of what works and what doesn't.

Keep in mind that this advice is based on my experience. It may not work for you.
The advice is simple: Don't scare the reader on your first tweet.

If you announce that your thread is "huge" or that it is a "mega-thread," people will tend to shy away from it.

The same happens if you start your thread with something like "1/25."

25 tweets???!!!
Read 12 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!

:(