Add support to ignore first 50 iterations in calculating the remaining training time.

For first 50 iterations chart will display 'nan hours' as remaining training time.
pull/4976/head
Muhammad Maaz 5 years ago
parent d1d2ad9d8f
commit 1174bb7417
  1. 4
      src/detector.c
  2. 2
      src/image_opencv.cpp

@ -308,11 +308,13 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
time_remaining[i%1000] = (net.max_batches - i)*(end - start) / 60 / 60; time_remaining[i%1000] = (net.max_batches - i)*(end - start) / 60 / 60;
tmp = 0.0; tmp = 0.0;
int j, count = 0; int j, count = 0;
for (j = 0; j < 1000; ++j){ if (i > 50){
for (j = 0; j < 1000; ++j){
if (time_remaining[j] != 0){ if (time_remaining[j] != 0){
tmp += time_remaining[j]; tmp += time_remaining[j];
count++; count++;
} }
}
} }
draw_train_loss(windows_name, img, img_size, avg_loss, max_img_loss, i, net.max_batches, mean_average_precision, draw_precision, "mAP%", dont_show, mjpeg_port, tmp/count); draw_train_loss(windows_name, img, img_size, avg_loss, max_img_loss, i, net.max_batches, mean_average_precision, draw_precision, "mAP%", dont_show, mjpeg_port, tmp/count);
start = what_time_is_it_now(); start = what_time_is_it_now();

@ -1104,7 +1104,7 @@ extern "C" void draw_train_loss(char *windows_name, mat_cv* img_src, int img_siz
old_precision = precision; old_precision = precision;
iteration_old = current_batch; iteration_old = current_batch;
} }
sprintf(char_buff, "current avg loss = %2.4f iteration = %d approx. time remaining = %2.2f hours", avg_loss, current_batch, time_remaining); sprintf(char_buff, "current avg loss = %2.4f iteration = %d approx. time left = %2.2f hours", avg_loss, current_batch, time_remaining);
pt1.x = 15, pt1.y = draw_size + 18; pt1.x = 15, pt1.y = draw_size + 18;
pt2.x = pt1.x + 800, pt2.y = pt1.y + 20; pt2.x = pt1.x + 800, pt2.y = pt1.y + 20;
cv::rectangle(img, pt1, pt2, CV_RGB(255, 255, 255), CV_FILLED, 8, 0); cv::rectangle(img, pt1, pt2, CV_RGB(255, 255, 255), CV_FILLED, 8, 0);

Loading…
Cancel
Save