Satellite Image tagging code using PyTorch / Keras
Here is a sample of images we had to work with
Source: https://www.kaggle.com/c/planet-understanding-the-amazon-from-space/data
Note: the repo was developed in May 2017 on PyTorch 0.1. PyTorch was publicly announced in January 2017 and has seen tremendous changes since then.
You will find:
-
A script that output the mean and stddev of your image if you want to train from scratch
-
Composing data augmentations, also here. Note use Pillow-SIMD instead of PIL/Pillow. It is even faster than OpenCV
-
Equivalent in Keras - 216 lines ugh. Note: so much lines were needed because by default in Keras you either have the data augmentation with ImageDataGenerator or lazy loading of images with "flow_from_directory" and there is no flow_from_csv
-
Train_test_split, PyTorch version and Keras version
-
Weighted sampling training so that the model view rare cases more often
-
Failed word embeddings experiments to combine image and text data
-
Combined weighted loss function (softmax for unique weather tags, BCE for multilabel tags)
-
Selecting the best F2-threshold via stochastic search at the end of each epoch to maximize validation score. This is then saved along model parameter.