Home

Awesome

Open Cities AI Challenge: Segmenting Buildings for Disaster Resilience

Open Cities AI Challenge: Segmenting Buildings for Disaster Resilience. The pipeline follows severstal.

2nd place out of 1106 with 0.8575 jaccard index (top 1 -- 0.8598).

Prerequisites

pip install -r requirements.txt

Usage

Download

First download the train and test data from the competition link into data folder.

Then you must prepare train and test datasets. For train use:

python ./src/data/prepare_train.py

Actually, it's hard to install all dependencies like GDAL etc. So, it's better to use code from competition forum in Getting started topic by @johnowhitaker. Or even better download extracted tiles from kaggle dataset

kaggle d download kbrodt/oc-t1-1024-z19-p1
kaggle d download kbrodt/oc-t1-1024-z19-p2
kaggle d download kbrodt/oc-t1-1024-z19-p3

For test simply use

python ./src/data/prepare_test.py

Train

To train the model run

sh ./train.sh

On 6 GPUs Tesla V100 it will take around 50h. This will generates trained models and submission file.

Predict

If you want only predict the test set, first you need to download model weights from yandex disk, unzip and execute:

sh ./submit.sh

On 6 GPUs Tesla V100 it takes around 1h.

Approach

It turned out the approach is quite straightforward. You can get good results by training Unet-like models with heavy encoders using only tier 1 data and some tricks. The main idea is to take into account the rare tiles. One way is to assign some class to the tile and use the inverse probability of that class in the dataset to oversample them. It significantly speeds up the learning process. The other trick is to change binary cross-entropy loss to multiclass cross-entropy (in our case 2 output channels) and take argmax instead of searching an optimal threshold. It is also preferred to train the model in the same conditions as at inference, i. e. at inference we have 1024x1024 tiles, so we need maximally to preserve this resolution during training. To overfit on testset one you can do pseudo-labelling. After obtaining a strong single model do train 5 more models and do ensemble them by simple averaging.

Summary

Tried

Possible improvements