Hello!
Below you can find a outline of how to reproduce my solution for the RSNA Intracranial Hemorrhage Detection competition.
Visit kaggle forum for solution overview: Kaggle RSNA Intracranial Hemorrhage Detection: 4th Place Solution
Our code is based on Appian's repo: https://github.com/appian42/kaggle-rsna-intracranial-hemorrhage
- Ubuntu 16.04
- NVIDIA 2080Ti
(python packages are detailed separately in requirements.txt
)
- Python 3.6.7
- CUDA 10.1
- CUDNN 7501
- NVIDIA Drivers 418.67
- Setup environment
- Place the raw data into ./IFE_1/input folder.
- The test data correspond to the test data provided in the Stage 2 of competition.
- Use stage 2 training data to train the model.
- The test data correspond to the test data provided in the Stage 2 of competition.
- cd IFE_1, run ./bin/preprocess.py to preprocess the training and test images and split the training data into five folds.
- To train:
- Train feature extraction models
- Go to IFE_1, IFE_2, IFE_3, run ./bin/train.sh to train five fold models. Models are saved in /model/. Best models are saved as foldx_best.pt.
- It will take about 24 ~ 48 hours to train each model for one fold.
- Go to IFE_1, IFE_2, IFE_3, run ./bin/train.sh to train five fold models. Models are saved in /model/. Best models are saved as foldx_best.pt.
- Extract features
- Go to IFE_1, IFE_2, IFE_3, run ./bin/gen_feat_train.sh and ./bin/gen_feat_test.sh to generate 1D (and 3D features). Use the best models generated from step 4.1.1.
- It will take around 5 hours to extract one feature set (train/test TTA5).
- Go to IFE_1, IFE_2, IFE_3, run ./bin/gen_feat_train.sh and ./bin/gen_feat_test.sh to generate 1D (and 3D features). Use the best models generated from step 4.1.1.
- Train classification models.
- Go to folder cls_1, cls_2, cls_3, run ./bin/train.sh, train five fold models for each folder.
- It will take around 3 hours to train 1D+3D model (single model), and around 1.5 hours to train 1D model (single model).
- Go to folder cls_1, cls_2, cls_3, run ./bin/train.sh, train five fold models for each folder.
- Train feature extraction models
- To infer:
- Extract test features.
- Go to folder IFE_1, IFE_2, IFE_3, run ./bin/gen_feat_test.sh to extract test features.
- Go to folder IFE_1, IFE_2, IFE_3, run ./bin/gen_feat_test.sh to extract test features.
- Predict classification probabilities
- Go to folder cls_1, cls_2, cls_3, run ./bin/predict.sh to predict result using extracted features.
- Go to folder cls_1, cls_2, cls_3, run ./bin/predict.sh to predict result using extracted features.
- Ensemble
- run ./libs/ensemble.sh to ensemble all the predictions.
- run ./libs/ensemble.sh to ensemble all the predictions.
- Extract test features.
- Models and features are generated in sequence. If one follows the above mentioned steps in order, all the softlinks should be valid by the time they are referred.