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.38k stars 799 forks source link

Poly learning rate scheduler not doing anything #263

Open connorlee77 opened 1 year ago

connorlee77 commented 1 year ago

The poly learning rate doesn't work as intended. The current implementation is as follows:

def get_lr(self):
        if self.last_epoch % self.decay_iter or self.last_epoch % self.max_iter:
            return [base_lr for base_lr in self.base_lrs]
        else:
            factor = (1 - self.last_epoch / float(self.max_iter)) ** self.gamma
            return [base_lr * factor for base_lr in self.base_lrs]

Notice that the else condition will never get hit since self.last_epoch % self.max_iter will almost always return a non-zero number.

hjhjb commented 1 year ago

我已收到,谢谢