Deep Learning for satellite imagery
The main objective of this blog is to develop methods for detecting icebergs using satellite radar data and high spatial resolution images in the visible spectral range. The methods of satellite monitoring of dangerous ice formations, like icebergs in the Arctic seas represent a threat to the safety of navigation and economic activity on the Arctic shelf.
The developed method of iceberg detection is based on statistical criteria for finding gradient zones in the analysis of two-dimensional fields of satellite images. The approaches proposed to detect icebergs from satellite data allow improving the quality and efficiency of service for a wide number of users with ensuring the efficiency and safety of Arctic navigation and activities on the Arctic shelf.
This project is a part of the Statoil/C-CORE Iceberg Classifier Challenge held on Kaggle.
Build an algorithm to automatically identify whether a remotely sensed target is an iceberg or not. Often times an iceberg is wrongly classified as a ship. The algorithm had to be extremely accurate because lives and billions of dollars in energy infrastructure are at stake.
The dataset can be downloaded from the kaggle website which can be found here.
- Icebergs in open water: icebergs will show bright spots against a dark background in optical images, higher wind reduces the contrast between open water and icebergs.
- Icebergs in drifting ice: icebergs will create tracks in the drifting ice if there are larger floes of consolidated ice. Difficult to distinguish icebergs from a background in optical images if only backscatter information is available.
- Icebergs in fast ice near calving areas: optical data shows shadows against the background, stationary ice means possible to identify icebergs over longer time periods.
Without much ado, let’s get started with the code. The complete project on github can be found here.
Let’s start with loading all the libraries and dependencies.
Next I loaded the training and test set images in json format.
Then I defined training and the test set data. I have splitted the data into 3:1 that is 75% as training and the rest as test set.
Before training the model is useful to define one or more callbacks. Pretty handy one, are:
- ModelCheckpoint: when training requires a lot of time to achieve a good result, often many iterations are required. In this case, it is better to save a copy of the best performing model only when an epoch that improves the metrics ends.
- EarlyStopping: sometimes, during training we can notice that the generalization gap (i.e. the difference between training and validation error) starts to increase, instead of decreasing. This is a symptom of overfitting that can be solved in many ways (reducing model capacity, increasing training data, data augumentation, regularization, dropout, etc). Often, a practical and efficient solution is to stop training when the generalization gap is getting worse.
Let’s continue with defining the model. This can be summarized in the below 5 steps-
- I used two convolutional layers followed by a maxpooling layer which in turn is followed by another convolutional layer. I have used 20% dropout in between to reduce overfitting.
- I repeated the same for four stacks for better generalization of results.
- Also I have used globalmaxpooling and batch-normalization layers to normalize the weights induced from the previous layers.
- The last layer is a dense layer with sigmoid as the activation function.
- Finally I have used Adam as the optmimizer and binary cross entropy is used as the loss function.
Let’s train the model for 20 epochs with a batch size of 32. Feel free to play with the hyper-parameters for better results.
Finally let’s visualize the results.
Both the training as well as the test set loss values are converging quite well. Also the model is able to achieve training and test set accuracy of 90% and 85% respectively in just 10 epochs.
I think this is one of the great examples where deep learning can be used to solve a challenging real-world problem. If we are able to detect and segment icebergs in an image, it would be of great help to the logistics and transportation team in northern countries like Sweden, Norway and Canada. It could bring a whole new dimension of transport for container ships and vessels by tracking icebergs from satellite images and videos in real-time.
The corresponding source code can be found here.
Happy reading, happy learning and happy coding.
If you want to keep updated with my latest articles and projects follow me on Medium. These are some of my contacts details: