Fix: Use iteration instead of i for current iteration.

Simplified the time remaining calculation logic.
pull/4976/head
Muhammad Maaz 5 years ago
parent 02e7109b8b
commit 1a6dd593c5
  1. 13
      src/detector.c

@ -169,8 +169,7 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
pthread_t load_thread = load_data(args); pthread_t load_thread = load_data(args);
int count = 0; int count = 0;
double start, end, time_remaining, avg_t_minus_1, avg_t, alpha = 0.01; double time_remaining, avg_t_minus_1, avg_t, alpha = 0.01;
start = what_time_is_it_now();
//while(i*imgs < N*120){ //while(i*imgs < N*120){
while (get_current_iteration(net) < net.max_batches) { while (get_current_iteration(net) < net.max_batches) {
@ -345,17 +344,15 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
draw_precision = 1; draw_precision = 1;
} }
#ifdef OPENCV #ifdef OPENCV
end = what_time_is_it_now(); time_remaining = (net.max_batches - iteration)*(what_time_is_it_now() - time + load_time) / 60 / 60;
time_remaining = (net.max_batches - i)*(end - start) / 60 / 60; if (iteration > 1){ // ignore the first iteration
if (i > 1){ // ignore the first iteration if (iteration == 2){
if (i == 2){
avg_t_minus_1 = time_remaining; avg_t_minus_1 = time_remaining;
} }
avg_t = alpha * time_remaining + (1 - alpha) * avg_t_minus_1; avg_t = alpha * time_remaining + (1 - alpha) * avg_t_minus_1;
avg_t_minus_1 = avg_t; avg_t_minus_1 = avg_t;
} }
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, avg_t); draw_train_loss(windows_name, img, img_size, avg_loss, max_img_loss, iteration, net.max_batches, mean_average_precision, draw_precision, "mAP%", dont_show, mjpeg_port, avg_t);
start = what_time_is_it_now();
#endif // OPENCV #endif // OPENCV
//if (i % 1000 == 0 || (i < 1000 && i % 100 == 0)) { //if (i % 1000 == 0 || (i < 1000 && i % 100 == 0)) {

Loading…
Cancel
Save