Unverified Commit fe095730 authored by Adrià Arrufat's avatar Adrià Arrufat Committed by GitHub
Browse files

Add progress information to console_progress_indicator (#2411)

* add progress information (current/total and percent)

* print a new line instead of overwritting with spaces

* check if target_val is an integer with std::trunc
parent 74653b4f
......@@ -30,7 +30,8 @@ namespace dlib
}
The above code will print a message to the console each iteration
which shows how much time is remaining until the loop terminates.
which shows the current progress and how much time is remaining until
the loop terminates.
!*/
public:
......@@ -72,8 +73,8 @@ namespace dlib
/*!
ensures
- print_status() assumes it is called with values which are linearly
approaching target(). It will attempt to predict how much time is
remaining until cur becomes equal to target().
approaching target(). It will display the current progress and attempt
to predict how much time is remaining until cur becomes equal to target().
- prints a status message to out which indicates how much more time is
left until cur is equal to target()
- if (always_print) then
......@@ -156,6 +157,15 @@ namespace dlib
out.setf(std::ios::fixed,std::ios::floatfield);
std::streamsize ss;
if (std::trunc(target_val) == target_val)
ss = out.precision(0);
else
ss = out.precision(2);
out << "Progress: " << cur << "/" << target_val;
ss = out.precision(2);
out << " (" << cur / target_val * 100. << "%). ";
if (seconds < 60)
{
ss = out.precision(0);
......
......@@ -346,7 +346,7 @@ namespace dlib
}
if (_verbose)
std::cout << "Training complete " << std::endl;
std::cout << "\nTraining complete" << std::endl;
return shape_predictor(initial_shape, forests, pixel_coordinates);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment