andy-yun / pytorch-0.4-yolov3

Yet Another Implimentation of Pytroch 0.4.1 and YoloV3 on python3
MIT License
278 stars 72 forks source link

learning rate/batch_size and loss #46

Closed leadcain84 closed 5 years ago

leadcain84 commented 5 years ago

appreciate of this great work!!

I have some questions about loss and learning rate.

In the region_layer.py of marvis/yolov2, all losses[cls, conf, etc.] are summed, learning rate in train.py are divided into batch_size. Just my guess, it is equal the back propagation as follow: w` = update weight w = current weight lr = learning rate

origin : w= w - lr * dw(average of batch) marvis : w = w - lr /batch * dw(sum of batch)

In your region_layer.py, losses is divided by nB and also lr of optimizer is divided by batch_size in the train.py

If possible, would you tell me about this intention?

andy-yun commented 5 years ago

lr/batch is the decaying equation along to the number of seen data. Losses are normalized by batch size (nB). Lr/batch is not related to loss sum. it is just adjusted along to number of training samples.

Sent with GitHawk