Cengizz
Cengizz

Reputation: 35

Can I continue to training from final .weight with more train and test images?

I trained my custom object detection with darknet yolov3 untill the average loss decreased down to 0.06 but now i want to train it with more training and test images (maybe also deleting some of the image files). Can I do these steps and continue to training with final .weights file or I should start it from the beginning?

Upvotes: 0

Views: 8838

Answers (5)

ZenjieLi
ZenjieLi

Reputation: 301

If you have just modified the data set, but are not interested in changing the model architecture,you can directly resume from the previously saved model using DarkNet in AlexeyAB/darknet. For example,

darknet.exe detector train cfg/obj.data cfg/yolov3.cfg yolov3_weights_last.weights -clear -map

The clear flag will reset iterations saved in the weights, which is appropriate in case of data set changes. That is because the learning rate often depends on the iterations, and you probably don't want to change the configurations.

Upvotes: 2

code-freeze
code-freeze

Reputation: 485

you can resume your training from the previously saved weights, of your custom model.
use the "yolov3_custom_last.weights" instead of the pre-trained default weights.
Incase you find some issues with resuming, try changing the batch size .

this should work and resume your model training with new set of images :)

Upvotes: 0

Erol Gerceker
Erol Gerceker

Reputation: 1

You need to specify more epochs if you resume. For example if you train to 300/300 then resume will also train to 300 also (starting at 300) unless you specify more epochs..

python train.py --resume

Upvotes: 0

MonkeyStack
MonkeyStack

Reputation: 11

open the .cfg, find the max_batches code may be in 22 row, set the bigger value:

max_batches = 500200

max_batches is the same to the tranning iteration.

How to continute training after 50000 iteration? #2633

Upvotes: -1

Hadi GhahremanNezhad
Hadi GhahremanNezhad

Reputation: 2445

Yes, you can use the currently trained model (.weights file) as the pre-trained model for the new training session. For example, if you use AlexeyAB repository you can train your model by a command like this:

darknet.exe detector train data/obj.data yolo-obj.cfg darknet53.conv.74

where darknet53.conv.74 is the pre-trained model.

In the new training session, you can add or remove images. However, the basic configurations should be correct (like the number of classes, etc).

According to the page I mentioned:

in the original repository original repository the weights-file is saved only once every 10 000 iterations

Upvotes: 1

Related Questions