From 40c9afa3816a60f7b126feec95b9742f4800fd50 Mon Sep 17 00:00:00 2001 From: Joseph Redmon Date: Wed, 3 May 2017 15:38:54 -0700 Subject: [PATCH] :fire: :darknet: :fire: --- src/detector.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/detector.c b/src/detector.c index c205f944..12277b1a 100644 --- a/src/detector.c +++ b/src/detector.c @@ -142,7 +142,15 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i i = get_current_batch(net); printf("%d: %f, %f avg, %f rate, %lf seconds, %d images\n", get_current_batch(net), loss, avg_loss, get_current_rate(net), sec(clock()-time), i*imgs); - if(i%1000==0 || (i < 1000 && i%100 == 0)){ + if(i%1000==0){ +#ifdef GPU + if(ngpus != 1) sync_nets(nets, ngpus, 0); +#endif + char buff[256]; + sprintf(buff, "%s/%s.backup", backup_directory, base); + save_weights(net, buff); + } + if(i%10000==0 || (i < 1000 && i%100 == 0)){ #ifdef GPU if(ngpus != 1) sync_nets(nets, ngpus, 0); #endif