Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ngxbac committed Sep 2, 2019
1 parent 48186f2 commit 08a2a9d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
45 changes: 28 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
2 changes: 2 additions & 0 deletions bin/train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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
2 changes: 1 addition & 1 deletion bin/train_control.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
Expand Down
8 changes: 4 additions & 4 deletions bin/train_pseudo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
Expand All @@ -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

0 comments on commit 08a2a9d

Please sign in to comment.