diff --git a/README.md b/README.md index 448938a..c043f01 100644 --- a/README.md +++ b/README.md @@ -6,28 +6,39 @@ - catalyst == 19.06.5 # How to train -- In `configs/config.yml` -Change: `stages/data_params/root` to your root data that you download from Kaggle +## Pretrained with controls +```bash +bash bin/train_control.sh +``` + +Pretrained models are saved at: +`/raid/bac/kaggle/logs/recursion_cell/pretrained_controls/$channels/se_resnext50_32x4d/` +where `channels` can be: `[1,2,3,4,5], etc` -- In `bin/train.sh` -Change: - - `export CUDA_VISIBLE_DEVICES=2,3` which GPUs are used for training - - `LOGDIR`: saved checkpoints, logs, etc - -- Run: `bash bin/train.sh` -- Take a coffe or go to sleep +## Train with pseudo data +```bash +bash bin/train_pseudo.sh +``` +* `PRETRAINED_CONTROL`: is the root folder of pretrained models above -# How to predict -Please refer `make_submission.py`. +* `--model_params/weight= +$PRETRAINED_CONTROL/$channels/se_resnext50_32x4d/checkpoints/best.pth:str \` is the weight of +corresponding model pretrained on controls dataset. -- Change following: -```python - test_csv = '/raid/data/kaggle/recursion-cellular-image-classification/test.csv' - # test_csv = './csv/valid_0.csv' - log_dir = "/raid/bac/kaggle/logs/recursion_cell/test/rgb_no_crop_512_accum2_456/se_resnext50_32x4d/" - root = "/raid/data/kaggle/recursion-cellular-image-classification/" +## Train with usually data +Similar to `Train with pseudo data` part +```bash +bash bin/train.sh ``` +* `PRETRAINED_CONTROL`: is the root folder of pretrained models above + +* `--model_params/weight= +$PRETRAINED_CONTROL/$channels/se_resnext50_32x4d/checkpoints/best.pth:str \` is the weight of +corresponding model pretrained on controls dataset. + + + - Run: `python src/make_submission.csv` \ No newline at end of file diff --git a/bin/train.sh b/bin/train.sh index ee0514e..8b4f544 100755 --- a/bin/train.sh +++ b/bin/train.sh @@ -4,6 +4,7 @@ export CUDA_VISIBLE_DEVICES=2,3 RUN_CONFIG=config.yml +PRETRAINED_CONTROL=/raid/bac/kaggle/logs/recursion_cell/pretrained_controls/ for channels in [1,2,3,4,5]; do for fold in 0; do LOGDIR=/raid/bac/kaggle/logs/recursion_cell/test/190824/dont_drop_1/fold_$fold/se_resnext50_32x4d/ @@ -14,6 +15,7 @@ for channels in [1,2,3,4,5]; do --stages/data_params/channels=$channels:list \ --stages/data_params/train_csv=./csv/train_$fold.csv:str \ --stages/data_params/valid_csv=./csv/valid_$fold.csv:str \ + --model_params/weight=$PRETRAINED_CONTROL/$channels/se_resnext50_32x4d/checkpoints/best.pth:str \ --verbose done done \ No newline at end of file diff --git a/bin/train_control.sh b/bin/train_control.sh index 49a85b4..788e93b 100755 --- a/bin/train_control.sh +++ b/bin/train_control.sh @@ -3,7 +3,7 @@ export CUDA_VISIBLE_DEVICES=2,3 RUN_CONFIG=config_control.yml -for channels in [1,2,3,4,6] [1,2,3,5,6] [1,2,4,5,6] [1,3,4,5,6] [2,3,4,5,6]; do +for channels in [1,2,3,4,5] [1,2,3,4,6] [1,2,3,5,6] [1,2,4,5,6] [1,3,4,5,6] [2,3,4,5,6]; do LOGDIR=/raid/bac/kaggle/logs/recursion_cell/pretrained_controls/$channels/se_resnext50_32x4d/ catalyst-dl run \ --config=./configs/${RUN_CONFIG} \ diff --git a/bin/train_pseudo.sh b/bin/train_pseudo.sh index 122d868..e930fe7 100755 --- a/bin/train_pseudo.sh +++ b/bin/train_pseudo.sh @@ -4,9 +4,9 @@ export CUDA_VISIBLE_DEVICES=2,3 RUN_CONFIG=config_pseudo.yml -PRETRAINED_CONTROL='' -for channels in [1,2,3,4,5] [1,2,3,4,6] [1,2,3,5,6] [1,2,4,5,6] [1,3,4,5,6] [2,3,4,5,6]; do - for fold in 0; do +PRETRAINED_CONTROL=/raid/bac/kaggle/logs/recursion_cell/pretrained_controls/ +for channels in [1,2,3,4,6] [1,2,3,5,6]; do + for fold in 0 1 2 3 4; do LOGDIR=/raid/bac/kaggle/logs/recursion_cell/pseudo_from_control/$channels/fold_$fold/se_resnext50_32x4d/ catalyst-dl run \ --config=./configs/${RUN_CONFIG} \ @@ -15,7 +15,7 @@ for channels in [1,2,3,4,5] [1,2,3,4,6] [1,2,3,5,6] [1,2,4,5,6] [1,3,4,5,6] [2,3 --stages/data_params/channels=$channels:list \ --stages/data_params/train_csv=./csv/pseudo/train_$fold.csv:str \ --stages/data_params/valid_csv=./csv/pseudo/valid_$fold.csv:str \ - --model_params/weight=$PRETRAINED_CONTROL/$channels/se_resnext50_32x4d/checkpoints/best.pth \ + --model_params/weight=$PRETRAINED_CONTROL/$channels/se_resnext50_32x4d/checkpoints/best.pth:str \ --verbose done done \ No newline at end of file