Changing the learning rate in cfg file doesn't change it when training
Hi everyone, I am using the yolov2 model and fine tuning it on my two-classes dataset. I am using yolo.weights I have downloaded the weights from darknet website and yolo.cfg as a base. In yolo.cfg, I have changed the class number (2) and filters (35) and created a yolo-test.cfg file. Now I’m trying to change the learning rate, decay batch size and subdivision values and my yolo-test.cfg file looks like this:
yolo-test.cgf
[net]
Testing
#batch=1 #subdivisions=1
Training
batch=64 subdivisions=8 width=608 height=608 channels=3 momentum=0.9 decay=0.0005 angle=0 saturation = 1.5 exposure = 1.5 hue=.1
learning_rate=0.001 burn_in=1000 max_batches = 500200 policy=steps steps=400000,450000 scales=.1,.1
I train the model using the following command: “./flow --model cfg/yolo-test.cfg --load weights/yolo.weights --train --annotation /sharedfolder/Yolo_TrainData/Annotation --dataset /sharedfolder/Yolo_TrainData/Images”
My issue it that it always trains with the default learning rate 1e-5 and batch size of 16 . Training statistics: Learning rate : 1e-05 Batch size : 16 Epoch number : 1000 Backup every : 2000
Does anyone know why the parameters from the .cfg file are not applied during the training and how to make this work? Thank you
Darkflow does not use the learning rate in .cfg. Use --lr
I've a question, Did you see any difference in changing the batch=64 and subdivisions=8? During training ? and during testing?
During training, if I want change batch I had to use --batch instead.
@SkullPirateTK how about the decay ? does this mean we cant have an adaptive learning rate with darkflow ?
@ambr89 I have the same issue
darkflow does not utilize all the properties in darknet (at least for now). Batch size, subdivision, learning rate (and its changing policy) are some of them. These are assigned with default values given in default.py. I also wish darkflow fully utilizes darknet, but no.
Darkflow does not use the learning rate in .cfg. Use --lr instead.
@SkullPirateTK Hi, How to use this --lr in the code? I have tried but it again starts from 0.001 learning rate.
@aaobscure e.g. flow --lr 0.01
@aaobscure e.g. flow --lr 0.01
I use this code but it is not working,
!./darknet detector train cfg/obj.data cfg/yolov3-IDcard.cfg backup/yolov3-IDcard_last.weights -dont_show flow --lr 0.0005
@aaobscure sorry if it wasn't clear. it should be something like this, if you're attempting to train custom weights:
!python flow --model cfg/tiny-yolo-voc-1c.cfg \
--load bin/tiny-yolo-voc.weights \
--train \
--annotation new_model_data/image_annotations/ \
--dataset new_model_data/images/ \
--gpu 0.85 \
--epoch 300 \
--lr 0.01
I hope I'm properly understanding your q.
Hello everybody? I was wondering how to apply the change of the learning rate if I´m using Google Colab for the training. Or how to properly apply the --lr function, because a need a little kick to get a better performance on my network. Thanks
You can check it from darkflow/defaults.py and change any parameters as per your requirements