From 1174bb741763bba55eb74a9a8c71baa2ee66803e Mon Sep 17 00:00:00 2001 From: Muhammad Maaz Date: Fri, 6 Mar 2020 12:58:16 +0500 Subject: [PATCH] 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. --- src/detector.c | 4 +++- src/image_opencv.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/detector.c b/src/detector.c index 8052c36e..ca1c157f 100644 --- a/src/detector.c +++ b/src/detector.c @@ -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; tmp = 0.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){ tmp += time_remaining[j]; 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(); diff --git a/src/image_opencv.cpp b/src/image_opencv.cpp index 3854084f..7adf6231 100644 --- a/src/image_opencv.cpp +++ b/src/image_opencv.cpp @@ -1104,7 +1104,7 @@ extern "C" void draw_train_loss(char *windows_name, mat_cv* img_src, int img_siz old_precision = precision; 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; pt2.x = pt1.x + 800, pt2.y = pt1.y + 20; cv::rectangle(img, pt1, pt2, CV_RGB(255, 255, 255), CV_FILLED, 8, 0);