Coder Social home page Coder Social logo

feiwofeifeixiaowo / argus-tgs-salt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lromul/argus-tgs-salt

0.0 1.0 0.0 885 KB

Kaggle | 14th place solution for TGS Salt Identification Challenge

License: MIT License

Python 74.76% Dockerfile 0.12% Shell 0.35% Jupyter Notebook 24.76%

argus-tgs-salt's Introduction

Argus solution TGS Salt Identification Challenge

Source code of 14th place solution for TGS Salt Identification Challenge by Argus team (Ruslan Baikulov, Nikolay Falaleev).

Solution

We used PyTorch 0.4.1 with framework Argus simplifies the experiments with different architectures and allows to focus on deep learning trials rather than coding neural networks training and testing scripts.

Data preprocessing

The original images with size 101x101 px padded to 148x148 px with biharmonic inpaint from skimage package. This “padding” performed better for us than reflection or zero padding. Random crop to the input size 128x128 px, flip in the left-right direction and random linear color augmentation (for brightness and contrast adjustment) were applied.

Model design:

General scheme of the neural networks architectures

After a series of experiments, we ended with a U-Net like architecture with an SE-ResNeXt50 encoder. Standard decoder blocks enriched with custom-built FPN-style layers. In addition to the segmentation task, an additional classification branch (empty/contains salt tile) added into basic network architecture.

Models Training

Loss: Lovasz hinge loss with elu + 1
Optimizer: SGD with LR 0.01, momentum 0.9, weight_decay 0.0001
Train stages:

  1. EarlyStopping with patience 100; ReduceLROnPlateau with patience=30, factor=0.64, min_lr=1e-8; Lovasz * 0.75 + BCE empty * 0.25.
  2. Cosine annealing learning rate 300 epochs, 50 per cycle; Lovasz * 0.5 + BCE empty * 0.5.

Post-processing

Averaged results of two training used in the final submission: SE-ResNeXt50 on 5 random folds. SE-ResNeXt50 on 6 mosaic based folds (similar mosaics tiles placed in the same fold) without the second training stage.

Mosaics-based post-processing. We used the Vicens Gaitan’s Kernel but not on a raw input dataset, but on images after histogram matching to an average histogram, which helps us to assembly more tiles into mosaics. In addition to extrapolating tiles with vertical masks from train subset on neighbouring tiles, we performed an automatic detection of small missed corners and inpaint them by a polygon with a smooth-curve boundary. Holes in masks were also filled with OpenCV.

Results

Sample results image

Example of the whole mosaic post-processing. Green/blue - salt/empty regions from the train dataset; red - predicted mask; yellow - inpainted by the post-processing (used in the final submission).

The results are based on a step-by-step improvement of the pipeline, postprocessing, and fair cross-validation. Finally, results were achieved by carefully selected architectures without heavy ensembles of neural nets and second order models. Reasonable cross-validation with the evaluation metric prevented us from overfitting on the public leaderboard.

For more details on data pre- and post-processing, as well as conducted experiments with neural nets, check out a blog post.

Quick setup and start

Requirements

The provided dockerfile is supplied to build image with cuda support and cudnn.

Preparations

  • Clone the repo, build docker image.

    git clone https://github.com/lRomul/argus-tgs-salt.git
    cd argus-tgs-salt/docker 
    ./build.sh
  • Download and extract dataset

    • extract train images and masks into data/train/
    • extract test images into data/test/
  • The folder structure should be:

    argus-tgs-salt
    ├── data
    │   ├── mosaic
    │   ├── test
    │   └── train
    ├── docker
    ├── mosaic
    ├── notebooks
    ├── pipeline
    ├── src
    └── unused
    

Run

  • Run docker container
cd docker
./run.sh
  • Start full pipeline with postprocessing
./run_pipeline.sh

The final submission file will be at:

data/predictions/mean-005-0.4/submission.csv

argus-tgs-salt's People

Contributors

lromul avatar

Watchers

normal avatar

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.