From da10b0f6de309371f19cc55d541be66bffb91cfa Mon Sep 17 00:00:00 2001 From: LeoXing1996 Date: Mon, 31 Oct 2022 07:17:46 +0800 Subject: [PATCH] [Enhancement] Add pixel value clip in visualizer (#1365) add pixel value clip in visualizer --- mmedit/visualization/gen_visualizer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmedit/visualization/gen_visualizer.py b/mmedit/visualization/gen_visualizer.py index 13d976e2b3..0ffdc11cde 100644 --- a/mmedit/visualization/gen_visualizer.py +++ b/mmedit/visualization/gen_visualizer.py @@ -54,7 +54,7 @@ def _post_process_image(image: Tensor, mean: mean_std_type = None, std: mean_std_type = None) -> Tensor: """Post process images. First convert image to `rgb` order. And then - de-norm image to fid `mean` and `std` if `mean` and `std` is passed. + de-norm image to `mean` and `std` if they are passed. Args: image (Tensor): Image to pose process. @@ -73,7 +73,7 @@ def _post_process_image(image: Tensor, image = image[:, [2, 1, 0], ...] if mean is not None and std is not None: image = image * std + mean - return image + return image.clamp(0, 255) @staticmethod def _get_n_row_and_padding(samples: Tuple[dict, Tensor],