Pytorch-yolov3: how to change the learning-rate?

Created on 22 Dec 2019  ·  1Comment  ·  Source: eriklindernoren/PyTorch-YOLOv3

how to change the learning-rate?

Most helpful comment

@W998K
Before training, you can simply set like:
optimizer = torch.optim.Adam(model.parameters(), lr=0.0001)

Within training, I suggest you can try LR scheduler (very useful for training):

optimizer = torch.optim.SGD(model.parameters(), lr=0.1, momentum=0.9)
scheduler = ReduceLROnPlateau(optimizer, 'min')
for epoch in range(10):
    train(...)
    val_loss = validate(...)
    # Note that step should be called after validate()
    scheduler.step(val_loss)

>All comments

@W998K
Before training, you can simply set like:
optimizer = torch.optim.Adam(model.parameters(), lr=0.0001)

Within training, I suggest you can try LR scheduler (very useful for training):

optimizer = torch.optim.SGD(model.parameters(), lr=0.1, momentum=0.9)
scheduler = ReduceLROnPlateau(optimizer, 'min')
for epoch in range(10):
    train(...)
    val_loss = validate(...)
    # Note that step should be called after validate()
    scheduler.step(val_loss)
Was this page helpful?
0 / 5 - 0 ratings