Save weights for each 1000 iterations if max_batches < 10000

This commit is contained in:
AlexeyAB 2020-12-10 23:13:26 +03:00
parent 1b936ab9ad
commit b5ff7f4cd3
2 changed files with 7 additions and 3 deletions

View File

@ -4,9 +4,11 @@
Paper YOLO v4: https://arxiv.org/abs/2004.10934 Paper YOLO v4: https://arxiv.org/abs/2004.10934
Paper Scaled YOLO v4: https://arxiv.org/abs/2011.08036 use to reproduce results: https://github.com/WongKinYiu/ScaledYOLOv4 Paper Scaled YOLO v4: https://arxiv.org/abs/2011.08036 use to reproduce results: [ScaledYOLOv4](https://github.com/WongKinYiu/ScaledYOLOv4)
More details: [medium link_Scaled_YOLOv4](https://alexeyab84.medium.com/scaled-yolo-v4-is-the-best-neural-network-for-object-detection-on-ms-coco-dataset-39dfa22fa982?source=friends_link&sk=c8553bfed861b1a7932f739d26f487c8) and [medium link_YOLOv4](https://medium.com/@alexeyab84/yolov4-the-most-accurate-real-time-neural-network-on-ms-coco-dataset-73adfd3602fe?source=friends_link&sk=6039748846bbcf1d960c3061542591d7) More details in articles on medium:
* [Scaled_YOLOv4](https://alexeyab84.medium.com/scaled-yolo-v4-is-the-best-neural-network-for-object-detection-on-ms-coco-dataset-39dfa22fa982?source=friends_link&sk=c8553bfed861b1a7932f739d26f487c8)
* [YOLOv4](https://medium.com/@alexeyab84/yolov4-the-most-accurate-real-time-neural-network-on-ms-coco-dataset-73adfd3602fe?source=friends_link&sk=6039748846bbcf1d960c3061542591d7)
Manual: https://github.com/AlexeyAB/darknet/wiki Manual: https://github.com/AlexeyAB/darknet/wiki

View File

@ -382,7 +382,9 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
//if (i % 1000 == 0 || (i < 1000 && i % 100 == 0)) { //if (i % 1000 == 0 || (i < 1000 && i % 100 == 0)) {
//if (i % 100 == 0) { //if (i % 100 == 0) {
if (iteration >= (iter_save + 10000) || iteration % 10000 == 0) { if ((iteration >= (iter_save + 10000) || iteration % 10000 == 0) ||
(iteration >= (iter_save + 1000) || iteration % 1000 == 0) && net.max_batches < 10000)
{
iter_save = iteration; iter_save = iteration;
#ifdef GPU #ifdef GPU
if (ngpus != 1) sync_nets(nets, ngpus, 0); if (ngpus != 1) sync_nets(nets, ngpus, 0);