Skip to content

Commit

Permalink
Using AdamW, 1cycle policy. CV: 46%, LB: 32.4%
Browse files Browse the repository at this point in the history
  • Loading branch information
ngxbac committed Jul 5, 2019
1 parent ac04128 commit 4b58ab1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bin/train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export CUDA_VISIBLE_DEVICES=2,3
RUN_CONFIG=config.yml


LOGDIR=/raid/bac/kaggle/logs/recursion_cell/test/c123_s1/se_resnext50_32x4d/
LOGDIR=/raid/bac/kaggle/logs/recursion_cell/test/c123_s1_1cycle_adamw/se_resnext50_32x4d/
catalyst-dl run \
--config=./configs/${RUN_CONFIG} \
--logdir=$LOGDIR \
Expand Down
16 changes: 9 additions & 7 deletions configs/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ stages:
criterion: CrossEntropyLoss

optimizer_params:
optimizer: Adam
lr: 0.0003
weight_decay: 0.0001
optimizer: AdamW
lr: 0.0001
# weight_decay: 0.0001

scheduler_params:
scheduler: MultiStepLR
milestones: [25, 30, 40]
gamma: 0.5
scheduler: OneCycleLR
num_steps: &num_epochs 30
lr_range: [0.0005, 0.00001]
warmup_steps: 5
momentum_range: [0.85, 0.95]

data_params:
batch_size: 64
Expand All @@ -46,7 +48,7 @@ stages:
stage1:

state_params:
num_epochs: 45
num_epochs: *num_epochs

callbacks_params: &callback_params
loss:
Expand Down
6 changes: 3 additions & 3 deletions src/make_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def predict(model, loader):
def predict_all():
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/c123_s1_concatpool/se_resnext50_32x4d/"
log_dir = "/raid/bac/kaggle/logs/recursion_cell/test/c123_s1_1cycle_adamw/se_resnext50_32x4d/"
root = "/raid/data/kaggle/recursion-cellular-image-classification/"
site = 1
channels = [1,2,3]
Expand Down Expand Up @@ -75,8 +75,8 @@ def predict_all():
submission = df.copy()
submission['sirna'] = all_preds.astype(int)
os.makedirs("submission", exist_ok=True)
submission.to_csv('./submission/se_resnext50_32x4d_c123_s1_concatpool.csv', index=False, columns=['id_code', 'sirna'])
np.save("./submission/se_resnext50_32x4d_c123_s1_concatpool.npy", pred)
submission.to_csv('./submission/se_resnext50_32x4d_c123_s1_1cycle_adamw.csv', index=False, columns=['id_code', 'sirna'])
np.save("./submission/se_resnext50_32x4d_c123_s1_1cycle_adamw.npy", pred)


if __name__ == '__main__':
Expand Down

0 comments on commit 4b58ab1

Please sign in to comment.