Using test time augmentation to improve accuracy
Most of the time, when we're testing the predictive power of a network, we use a test set to do so. This test set is comprised of images the model has never seen. Then, we present them to the model and ask it what class each belongs to. The thing is… we do it once.
What if we were more forgiving and gave the model multiple chances to do this? Would its accuracy improve? Well, more often than not, it does!
This technique is known as Test Time Augmentation (TTA), and it's the focus of this recipe.
Getting ready
In order to load the images in the dataset, we need Pillow
. Install it using the following command:
$> pip install Pillow
Then, download the Caltech 101
dataset, which is available here: http://www.vision.caltech.edu/Image_Datasets/Caltech101/. Download and decompress 101_ObjectCategories.tar.gz
to a location of your choosing. For the rest of this recipe, we'll work under the assumption...