Skip to content

About

A solution to the Kaggle competition of the same name!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

43 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geophysical_waveform_inversion

A solution to the Kaggle competition of the same name!

The GWI competition on Kaggle was a lot of fun! It was also a great learning experience.

This repository contains all the code I used to train a model that (after competition finished) achieves 19.19 on private LB (position 33). This is a single model — you can further improve the score by training an additional model and ensembling predictions. Possibly, the CAFormer architecture should also perform better.

I list lessons learned from this competition in a blog post here.

I make all the data I generated (including model weights) available on Kaggle:

  • model weights
  • augmented data: 1, 2, 3, 4, 5, 6
  • pseudo-labelled data with regenerated seismis information: 1, 2

Summary of trained models:

Training Data Num Train Steps Private LB Score Checkpoint Name
Kaggle train data (0.05 random val) 1111800 29.55 CustomUNet_f0_epoch120_bs48_lr0.001_full_w_flip_aug.pt
Kaggle train data (0.05 random val) and augmented data 910214 26.96 CustomUNet_f0_epoch2_bs48_lr0.0005_full.pt
^^^ with 1st round pseudo 29506 23.47 CustomUNet_f0_epoch2_bs48_lr0.0005_full_pseudo_ro1.pt
^^^ with 1st and 2nd round pseudo 69846 22.50 CustomUNet_f0_epoch2_bs48_lr0.0005_full_pseudo_ro2.pt
Larger model trained on all available data (Kaggle train, aug, pseudo) 1122680 19.19 CustomUNet_f0_epoch40_bs48_lr0.001_full.pt

Overview of the solution

I intentionally went for a simple architecture to prove to myself that indeed endlessly tweaking the architecture was a dead end.

I first trained a small ConvNeXt Unet on competition data and augmented data I generated offline. I used the trained model to predict on the test set (pseudo-labelling), but I regenerated the seis (inputs from predicted targets) using forward seismic modelling.

I did 3 rounds of the train - predict - regenerate loop.

I then train a Unet with a larger backbone(convnext_large.fb_in22k_ft_in1k) an all of the data (train, augmented, pseudo-labels with regenerated input).

Ultimately, the model achieves 19.19 score which would place it in position 33 on the private leaderboard.

We could improve on this solution by utilizing further tricks from the competition, though I suspect training another model (a Unet with a CAFormer backbone) should offer a significant boost. You could also train one model of a given type per fold, ensemble predictions, etc. While I am tempted to try this, I opt not to. Compute (I have to train on rented hardware) and my attention are relatively scarce resources that now I have gotten what I wanted from this competition, I'd rather invest elsewhere.

Time to ship and move onto the next project.

Setup

Run setup_machine.sh. Before doing so, you need to set the following environment variables:

  • KAGGLE_USERNAME: Your Kaggle username
  • KAGGLE_KEY: Your Kaggle API key

You can either export these variables in your shell or create a .env file with them.

After performing setup and downloading all of the data (~2 TB), you can train a good model by running:

USE_PSEUDO=true USE_AUGMENTED=true NUM_EPOCHS=42 CUSTOM_UNET_BACKBONE=convnext_large.fb_in22k_ft_in1k  exec_nb --verbose train.ipynb

from the root of this repository.

About

A solution to the Kaggle competition of the same name!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages