From be55021c571068f6b8a22dd4147b2f6e0c43d688 Mon Sep 17 00:00:00 2001 From: HanCheng <61539236+chenghancc@users.noreply.github.com> Date: Mon, 15 Aug 2022 16:43:02 +0800 Subject: [PATCH] Update tools.py If you don't use the condition expression speed may be 0 initially deep-person-reid-master\torchreid\utils\tools.py", line 86, in _reporthook speed = int(progress_size / (1024*duration)) ZeroDivisionError: float division by zero --- torchreid/utils/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchreid/utils/tools.py b/torchreid/utils/tools.py index 518fa1886..2ccf63ab0 100644 --- a/torchreid/utils/tools.py +++ b/torchreid/utils/tools.py @@ -83,7 +83,7 @@ def _reporthook(count, block_size, total_size): return duration = time.time() - start_time progress_size = int(count * block_size) - speed = int(progress_size / (1024*duration)) + speed = 0 if duration == 0 else int(progress_size / (1024*duration)) percent = int(count * block_size * 100 / total_size) sys.stdout.write( '\r...%d%%, %d MB, %d KB/s, %d seconds passed' %