From dca830bbe03537a5a0c43eb1cd574f02b5f346e9 Mon Sep 17 00:00:00 2001 From: vlpr Date: Fri, 17 May 2024 07:17:01 +0000 Subject: [PATCH] better validation total time output --- src/common/validation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/validation.py b/src/common/validation.py index 97f58f8..1c50d6e 100644 --- a/src/common/validation.py +++ b/src/common/validation.py @@ -5,6 +5,7 @@ from common.utils import PSNR, cal_ssim, logger_info, _rgb2ycbcr, modcrop from pathlib import Path from PIL import Image import time +from datetime import timedelta def val_image_pair(model, hr_image, lr_image, output_image_path=None, device='cuda'): with torch.inference_mode(): @@ -70,7 +71,7 @@ def valid_steps(model, datasets, config, log_prefix=""): len(test_dataset), np.mean(lr_areas), total_area, - total_time + timedelta(seconds=total_time) ] results.append(row) column_names = [ @@ -82,7 +83,7 @@ def valid_steps(model, datasets, config, log_prefix=""): 'Image count', 'AVG image area', 'Total area', - 'Total time, s' + 'Total time' ] config.logger.info("\n" + str(pd.DataFrame([row], columns=column_names).set_index('Dataset').T)) config.writer.flush()