better validation total time output

main
vlpr 7 months ago
parent 3121584af4
commit dca830bbe0

@ -5,6 +5,7 @@ from common.utils import PSNR, cal_ssim, logger_info, _rgb2ycbcr, modcrop
from pathlib import Path from pathlib import Path
from PIL import Image from PIL import Image
import time import time
from datetime import timedelta
def val_image_pair(model, hr_image, lr_image, output_image_path=None, device='cuda'): def val_image_pair(model, hr_image, lr_image, output_image_path=None, device='cuda'):
with torch.inference_mode(): with torch.inference_mode():
@ -70,7 +71,7 @@ def valid_steps(model, datasets, config, log_prefix=""):
len(test_dataset), len(test_dataset),
np.mean(lr_areas), np.mean(lr_areas),
total_area, total_area,
total_time timedelta(seconds=total_time)
] ]
results.append(row) results.append(row)
column_names = [ column_names = [
@ -82,7 +83,7 @@ def valid_steps(model, datasets, config, log_prefix=""):
'Image count', 'Image count',
'AVG image area', 'AVG image area',
'Total area', 'Total area',
'Total time, s' 'Total time'
] ]
config.logger.info("\n" + str(pd.DataFrame([row], columns=column_names).set_index('Dataset').T)) config.logger.info("\n" + str(pd.DataFrame([row], columns=column_names).set_index('Dataset').T))
config.writer.flush() config.writer.flush()

Loading…
Cancel
Save