/ML_ShipDetection

Detectron2 and FastAI based ship segmentation for Kaggle dataset.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Instance segmentation framework for kaggle ship detection1 using Pytorch based toolboxes Detectron2 and Fastai.

Final presentation 2

image of framework

Setup

  • Requirements:
    • Unix based OS (Linux/Mac OS).
    • Nvidia GPU with cuda 10.1 installed, and at least 10GB of vram.
    • Docker (version == 19.03) and docker-compose (version == 3.6)
    • 40GB of free space: ~10GB for docker image, ~30GB for data

*All other dependencies are taken care of by docker-compose.

Data

kaggle competitions download -c airbus-ship-detection

Use the Kaggle API to download the dataset 3

Put it in folder named input

Model preprocessing / training and Kaggle submittion

docker-compose up 
  • Training: In the container, open the notebook module_notebook and run all.
  • Metrics: tensorboard for metrics, use another jupiter notebook and !tensorboard --logdir=runs --host=0.0.0.0 and if run on a local machine use a browser to go to http://0.0.0.0:6006.

Quick overview:

  • Data Loader (module_preprocessing) 4
  • Classifier (FastAI) 5
    • Output probability of ship on image.
    • Resnet34
  • Instance Segmentation/Object Detection (Detectron2) 6
    • Output pixel mask of ships.
    • Augmentations 78
      • Flips (Vertical 50%, Horisontal 50%)
      • Rotation (-20/+20 random rotation)
      • Random lighting (0.1 standard deviations)
    • Mask RCNN 50 layer pretrained on Coco .
      • 3 stage training (256x256,512x512,756x756) 9
    • Validation every 5k iterations.
  • Predictions on validation (module_submit)
  • Kaggle submission (module_submit) 4

Project

  • Kaggle proptotype
  • Initial presentation
  • Data Loader module
  • Training module
  • Add data Augmentations
  • Submit module
  • Classification module
  • Dockerize project
  • Argumentize code
  • Train
  • Inference
  • Submit

Footnotes

  1. https://www.kaggle.com/c/airbus-ship-detection/overview

  2. https://docs.google.com/presentation/d/1O3DLAQ9SKukEivKACH7JCZqiKiia6ratmZuc1KuovQk/edit?usp=sharing

  3. https://github.com/Kaggle/kaggle-api

  4. https://github.com/pascal1129/kaggle_airbus_ship_detection 2

  5. https://www.fast.ai/

  6. https://github.com/facebookresearch/detectron2

  7. https://jss367.github.io/Data-Augmentation-with-Detectron2.html

  8. https://link.springer.com/chapter/10.1007/978-981-15-5558-9_9

  9. https://www.kaggle.com/iafoss/unet34-dice-0-87/notebook