Set cur_iteration = 0; initially

pull/5002/head
AlexeyAB 5 years ago
parent 6c4886485d
commit a567a806a6
  1. 5
      src/classifier.c
  2. 2
      src/darknet.c
  3. 5
      src/detector.c
  4. 10
      src/parser.c
  5. 5
      src/rnn.c
  6. 5
      src/tag.c

@ -48,7 +48,10 @@ void train_classifier(char *datacfg, char *cfgfile, char *weightfile, int *gpus,
if(weightfile){ if(weightfile){
load_weights(&nets[i], weightfile); load_weights(&nets[i], weightfile);
} }
if(clear) *nets[i].seen = 0; if (clear) {
*nets[i].seen = 0;
*nets[i].cur_iteration = 0;
}
nets[i].learning_rate *= ngpus; nets[i].learning_rate *= ngpus;
} }
srand(time(0)); srand(time(0));

@ -165,6 +165,7 @@ void oneoff(char *cfgfile, char *weightfile, char *outfile)
copy_cpu(l.n/3*l.c, l.weights, 1, l.weights + l.n/3*l.c, 1); copy_cpu(l.n/3*l.c, l.weights, 1, l.weights + l.n/3*l.c, 1);
copy_cpu(l.n/3*l.c, l.weights, 1, l.weights + 2*l.n/3*l.c, 1); copy_cpu(l.n/3*l.c, l.weights, 1, l.weights + 2*l.n/3*l.c, 1);
*net.seen = 0; *net.seen = 0;
*net.cur_iteration = 0;
save_weights(net, outfile); save_weights(net, outfile);
} }
@ -176,6 +177,7 @@ void partial(char *cfgfile, char *weightfile, char *outfile, int max)
load_weights_upto(&net, weightfile, max); load_weights_upto(&net, weightfile, max);
} }
*net.seen = 0; *net.seen = 0;
*net.cur_iteration = 0;
save_weights_upto(net, outfile, max); save_weights_upto(net, outfile, max);
} }

@ -77,7 +77,10 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
if (weightfile) { if (weightfile) {
load_weights(&nets[k], weightfile); load_weights(&nets[k], weightfile);
} }
if (clear) *nets[k].seen = 0; if (clear) {
*nets[k].seen = 0;
*nets[k].cur_iteration = 0;
}
nets[k].learning_rate *= ngpus; nets[k].learning_rate *= ngpus;
} }
srand(time(0)); srand(time(0));

@ -1973,7 +1973,10 @@ network *load_network_custom(char *cfg, char *weights, int clear, int batch)
load_weights(net, weights); load_weights(net, weights);
} }
fuse_conv_batchnorm(*net); fuse_conv_batchnorm(*net);
if (clear) (*net->seen) = 0; if (clear) {
(*net->seen) = 0;
(*net->cur_iteration) = 0;
}
return net; return net;
} }
@ -1987,6 +1990,9 @@ network *load_network(char *cfg, char *weights, int clear)
printf(" Try to load weights: %s \n", weights); printf(" Try to load weights: %s \n", weights);
load_weights(net, weights); load_weights(net, weights);
} }
if (clear) (*net->seen) = 0; if (clear) {
(*net->seen) = 0;
(*net->cur_iteration) = 0;
}
return net; return net;
} }

@ -155,7 +155,10 @@ void train_char_rnn(char *cfgfile, char *weightfile, char *filename, int clear,
fprintf(stderr, "Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); fprintf(stderr, "Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
int batch = net.batch; int batch = net.batch;
int steps = net.time_steps; int steps = net.time_steps;
if(clear) *net.seen = 0; if (clear) {
*net.seen = 0;
*net.cur_iteration = 0;
}
int i = (*net.seen)/net.batch; int i = (*net.seen)/net.batch;
int streams = batch/steps; int streams = batch/steps;

@ -13,7 +13,10 @@ void train_tag(char *cfgfile, char *weightfile, int clear)
if(weightfile){ if(weightfile){
load_weights(&net, weightfile); load_weights(&net, weightfile);
} }
if(clear) *net.seen = 0; if (clear) {
*net.seen = 0;
*net.cur_iteration = 0;
}
printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
int imgs = 1024; int imgs = 1024;
list* plist = get_paths("tag/train.list"); list* plist = get_paths("tag/train.list");

Loading…
Cancel
Save