Code Monkey home page Code Monkey logo

kaggle-airbus-ship-detection's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.