Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

add left time in progress hook #817

Merged
merged 3 commits into from
Feb 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions chainercv/utils/iterator/progress_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ def __call__(self, in_values, out_values, rest_values):
self.n_processed += len(in_values[0])
fps = self.n_processed / (time.time() - self.start)
if self.n_total is not None:
eta = int((self.n_total - self.n_processed) / fps)
sys.stdout.write(
'\r{:d} of {:d} samples, {:.2f} samples/sec'.format(
self.n_processed, self.n_total, fps))
'\r{:d} of {:d} samples, {:.2f} samples/sec,'
' {:4d}:{:02d}:{:02d}'.format(
knorth55 marked this conversation as resolved.
Show resolved Hide resolved
self.n_processed, self.n_total, fps,
eta // 60 // 60, (eta // 60) % 60, eta % 60))
else:
sys.stdout.write(
'\r{:d} samples, {:.2f} samples/sec'.format(
Expand Down