复制 ResNet110(n=18)

Replicating ResNet110(n=18)

我试图在 cifar 10 中复制 resent 110 的相同结果,就像在图像识别的深度残差学习中一样。对于少于 110 层的 resnet,它是这样说的

We start with a learning rate of 0.1, divide it by 10 at 32k and 48k iterations, and terminate training at 64k iterations, which is determined on a 45k/5k train/val split.

对于具有 110 层的 resnet,它表示

In this case, we find that the initial learning rate of 0.1 is slightly too large to start converging. So we use 0.01 to warm up the training until the training error is below 80% (about 400 iterations), and then go back to 0.1 and con- tinue training. The rest of the learning schedule is as done previously.

如何在 pytorch 中根据训练错误或迭代(他们提到大约 400 次迭代)更改学习率??

一般来说,您可能正在寻找 torch.optim.lr_scheduler

具体来说,您可以使用 lr_scheduler.MultiStepLR[=13 在 n 轮之后实现 learning_rate 的缩减=]

按照建议的方式使用 lr_schedulers,您将需要重新计算从 stepsepochs 的里程碑作为更新是在整个时代而不是步骤之后完成的。

如果那不能给你满意的结果,你实际上可以通过调用来“作弊” scheduler.step() 在每个批次(步骤)之后,然后以步骤数通过里程碑。
请记住,不要让自己或有一天会碰巧编辑您的代码的人感到困惑,至少要发表评论以表明您正在以不太明显的方式使用库函数:D