Skip to content

Airbus Ship Detection Challenge (Kaggle) - Find ships on satellite images as quickly as possible

License

Notifications You must be signed in to change notification settings

davidtvs/kaggle-airbus-ship-detection

Repository files navigation

Kaggle Airbus Ship Selection Challenge

This is the source code for my submission to the Airbus Ship Selection Challenge hosted by Kaggle. Placed 479th with an F2 score of 0.83313.

Airbus Ship Selection Challenge

Repository structure

  • notebooks: contains some tests of new features made in Jupyter notebooks (F-score, run-length encoding/decoding, Dice loss, etc.)
  • src: code used for this submission.

Dependencies

  • Python 3
  • pip
  • pip install -r requirements.txt

ResNet34 Classifier and UNet34

The top-scoring model was a combination of two models:

  1. ship or no-ship classification ResNet34 replacing the last pooling layer and fully connected layer with an adaptive head based on the fast.ai ResNet models and AdaptiveConcatPool2d.

  2. segmentation network based on LinkNet with the following differences:

    • the ResNet18 encoder was replaced by a ResNet34;
    • the kernel size of the last transposed convolution in the final block was changed from 2 to 3. This made it possible for the network to accept any input image size without changing the output padding.

The ship or no-ship model predicts which images have ships. Images with ships are then passed to the segmentation network that performs pixel-wise ship segmentation.

The classifier model was trained using binary cross entropy loss with logits (BCEWithLogitsLoss) and the segmentation model was trained with binary cross entropy and dice with logits (BCE_BDWithLogitsLoss)

Usage and replicating results

The results can be replicated by following these steps:

  1. python train_classifier.py -c config/train_clf_224.json
  2. python train_classifier.py -c config/train_clf_384.json -m checkpoints/sns34_i224/sns34_i224.pth
  3. python train_classifier.py -c config/train_clf_768.json -m checkpoints/sns34_i384/sns34_i384.pth

At this point, the classifier is trained. The next step is to generate the dataset for training with the segmentation network. We could use the classifier during the segmentation training to generate the dataset in real-time but that is computationally expensive and not time efficient. The segmentation_dataset.py script will write the training images to a CSV instead.

  1. python segmentation_dataset.py -c config/segmentation_dataset.json

To train the segmentation network:

  1. python train_seg_binary.py -c config/train_seg_384.json
  2. python train_seg_binary.py -c config/train_seg_768.json -m checkpoints/linknet34_fscore_bce_bdl_i384/linknet34_fscore_bce_bdl_i384.pth

Finally, the models are combined with ComboNet and the submission is created:

  1. python make_submission.py -c config/make_submission.json

What didn't work

  • ENet gave lower performance
  • Standard LinkNet (with ResNet18) performed slightly worse
  • UNet by lyakaap took too much time to train.
  • Ground-truth ship segmentations weren't tight, i.e. they were more akin to oriented bounding boxes. Post-processing was applied to predictions to compute the oriented bounding box of each ship and fill it completely. This resulted in much worse performance.

About

Airbus Ship Detection Challenge (Kaggle) - Find ships on satellite images as quickly as possible

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published