Fixed bug, that save weights-file for each iteration

pull/492/head
AlexeyAB 7 years ago
parent 371f21171a
commit 164ba34279
  1. 4
      build/darknet/x64/resnet152_yolo.cfg
  2. 4
      build/darknet/x64/resnet50_yolo.cfg
  3. 1
      src/demo.c
  4. 9
      src/detector.c

@ -1,6 +1,6 @@
[net] [net]
batch=64 batch=64
subdivisions=8 subdivisions=32
height=416 height=416
width=416 width=416
channels=3 channels=3
@ -1470,4 +1470,4 @@ coord_scale=1
absolute=1 absolute=1
thresh = .6 thresh = .6
random=0 random=1

@ -1,6 +1,6 @@
[net] [net]
batch=64 batch=64
subdivisions=8 subdivisions=32
height=416 height=416
width=416 width=416
channels=3 channels=3
@ -517,4 +517,4 @@ coord_scale=1
absolute=1 absolute=1
thresh = .6 thresh = .6
random=0 random=1

@ -143,6 +143,7 @@ void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const ch
printf("video file: %s\n", filename); printf("video file: %s\n", filename);
cap = cvCaptureFromFile(filename); cap = cvCaptureFromFile(filename);
}else{ }else{
printf("Webcam index: %d\n", cam_index);
cap = cvCaptureFromCAM(cam_index); cap = cvCaptureFromCAM(cam_index);
} }

@ -43,9 +43,6 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
float avg_loss = -1; float avg_loss = -1;
network *nets = calloc(ngpus, sizeof(network)); network *nets = calloc(ngpus, sizeof(network));
int iter_save;
iter_save = 100;
srand(time(0)); srand(time(0));
int seed = rand(); int seed = rand();
int i; int i;
@ -79,6 +76,8 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
int init_w = net.w; int init_w = net.w;
int init_h = net.h; int init_h = net.h;
int iter_save;
iter_save = get_current_batch(net);
load_args args = {0}; load_args args = {0};
args.w = net.w; args.w = net.w;
@ -180,8 +179,8 @@ 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(i >= iter_save) { if(i >= (iter_save + 100)) {
iter_save += 100; iter_save = i;
#ifdef GPU #ifdef GPU
if (ngpus != 1) sync_nets(nets, ngpus, 0); if (ngpus != 1) sync_nets(nets, ngpus, 0);
#endif #endif

Loading…
Cancel
Save