Code for 1st place solution in Kaggle Understanding Clouds from Satellite Images Challenge.
To read the brief description of the solution, please, refer to the Kaggle post
To reproduce my submission without retraining, do the following steps:
- Installation
- Download Dataset
- Download Pretrained models
- run
bash reproduce.sh
All requirements should be detailed in requirements.txt. Using Anaconda is strongly recommended.
conda create -n cloud python=3.6
conda activate cloud
pip install -r requirements.txt
Download and extract train_images.zip and test_images.zip to data directory.
$ kaggle competitions download -c understanding_cloud_organization
$ unzip understanding_cloud_organization.zip -d data
$ chmod 644 data/*
$ unzip data/train_images.zip -d data/train_images
$ unzip data/test_images.zip -d data/test_images
$ python tools/split.py
$ python tools/resize_images.py
$ python tools/resize_labels.py
In the configs directory, you can find configurations I used to train my final models.
To train models, run following commands.
$ python run.py train with {config_path} -f
To average weights, run following commands.
$ python run.py swa with {config_path} swa.num_checkpoint=5 swa.ema=0.33 swa.epoch_end=40 -f
The result will be located in train_logs/{train_dir}/checkpoint.
You can download pretrained model that used for my submission from link
$ mkdir checkpoints
$ bash download_pretrained.sh
If trained weights are prepared, you can create files that contains class/mask probabilities of images.
$ python run.py inference with {config_path} \
inference.output_path={output_path} \
transform.params.tta={1..4} \
inference.split={split} \
checkpoint={checkpoint_path}
To evaluate dev/test_dev set, run following commands.
python tools/evaluate --input_dir {comma seperated list of inference_result_paths}
python tools/make_submission.py \
--input_dir {comma seperated list of inference_result_paths} \
--output {output_path}