Here is a simple trick that improves the results of your models.
Best part: You'll surprise your team. Guaranteed.
Thread: What is Test-Time Augmentation, and how you can start using it today.
↓
Let's start with Data Augmentation:
It allows us to artificially increase the size of a dataset without having to collect more data.
Data augmentation is key to improve the performance of our models.
Data augmentation is very popular when working with images.
We can apply different transformations to each image to obtain new samples:
• Cropping
• Rotations
• Flipping
• Zoom
We can then train the model with the augmented dataset and get much better results.
There's another way we can use data augmentation:
At the time of making predictions.
This technique is called "Test-Time Augmentation."
Let's see how this works.
Imagine you trained a Convolutional Neural Network to classify images.
Here is how you apply Test-Time Augmentation:
1. Get a request 1. Augment the input image 2. Run every image through the model 3. Average the softmax results 4. Argmax to get the most likely class
Notice that we aren't just predicting on the input image.
We are augmenting it and running the entire batch through the model.
This will give us a batch of softmax probabilities that we can average.
Finally, we can return the class corresponding to the largest value.
How is this better than just running the original image?
It might not be, but many times it is.
By augmenting the input image, we give our model more opportunities to "see" something different, get the correct prediction, and influence the results.
The key to making this work: Carefully tuning your augmentations.
Things you should experiment with:
• How many augmentations you use.
• How aggressive these augmentations are.
Good start: Use the same augmentations that you use to train your model.
How much improvement should you expect from using Test-Time Augmentation?
1. You need a lot of math to start 2. You need a Ph.D. to get a job 3. You always need a lot of data 4. You need to buy expensive hardware 5. It's hard to become proficient in it 6. It's the solution for most problems
Bullshit.
In the last 6 months, I've posted more than 100 threads here on Twitter talking about machine learning and how you can build a career on it.
And I'm just getting started!
Stay tuned. A lot more is coming.
First misconception: All machine learning is hardware-hungry.
Deep learning stretches you, but outside that, it gets much better.
If you need GPUs/TPUs, there are many free/cheap options you can use, especially while learning.