From 164ba34279a4d486d6e49409de791817b62ad1ac Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Fri, 16 Mar 2018 11:58:21 +0000
Subject: [PATCH] Fixed bug, that save weights-file for each iteration

---
 src/detector.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/detector.c b/src/detector.c
index 6d60cf0..9f608a0 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -43,9 +43,6 @@
     float avg_loss = -1;
     network *nets = calloc(ngpus, sizeof(network));
 
-	int iter_save;
-	iter_save = 100;
-
     srand(time(0));
     int seed = rand();
     int i;
@@ -79,6 +76,8 @@
 
 	int init_w = net.w;
 	int init_h = net.h;
+	int iter_save;
+	iter_save = get_current_batch(net);
 
     load_args args = {0};
     args.w = net.w;
@@ -180,8 +179,8 @@
 
 		//if (i % 1000 == 0 || (i < 1000 && i % 100 == 0)) {
 		//if (i % 100 == 0) {
-		if(i >= iter_save) {
-			iter_save += 100;
+		if(i >= (iter_save + 100)) {
+			iter_save = i;
 #ifdef GPU
 			if (ngpus != 1) sync_nets(nets, ngpus, 0);
 #endif

--
Gitblit v1.10.0