meetps / pytorch-semseg

Semantic Segmentation Architectures Implemented in PyTorch
https://meetshah.dev/semantic-segmentation/deep-learning/pytorch/visdom/2017/06/01/semantic-segmentation-over-the-years.html
MIT License
3.39k stars 797 forks source link

how to set lr scheduler? #186

Closed harora closed 5 years ago

harora commented 5 years ago

Hi I'm getting this error when i'm trying to set a poly_lr scheduler

Traceback (most recent call last): File "train.py", line 229, in train(cfg, writer, logger) File "train.py", line 86, in train scheduler = get_scheduler(optimizer, cfg["training"]["lr_schedule"]) File "/media/grace/Drive2/work2/pytorch-semseg/ptsemseg/schedulers/init.py", line 48, in get_scheduler return key2scheduler[s_type](optimizer, **scheduler_dict) TypeError: init() takes at least 3 arguments (2 given)

Following is my config file

`model: arch: icnetBN data: dataset: cityscapes train_split: train val_split: val img_rows: 1025 img_cols: 2049 path: data/ training: n_workers: 64 train_iters: 60000 batch_size: 8 val_interval: 500 print_interval: 25

loss:
    name: 'multi_scale_cross_entropy'
    size_average: True
optimizer:
    name: 'sgd'
    lr: 1.0e-2
    weight_decay: 0.0005
    momentum: 0.99
lr_schedule: 
    name: 'poly_lr'
resume: icnet_cityscapes_best_model.pkl`

Can anyone help with this?

HareshKarnan commented 5 years ago

you need to set max_iter for poly_lr

BaiLu-BL commented 4 years ago

Is the max_iter for poly_lr seem strange? After epoch exceeds max_iter, the factor becomes negative. If epoch is smaller than max_iter, lr seems not being updated.