diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2024-01-03 09:42:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-03 09:42:05 +0000 |
commit | 9c6ea5386b568f72fc8f539c7f3c90053fd64e4a (patch) | |
tree | 59b603c537703b200e0423e9746c665ef7ad207d | |
parent | e4dcdcc9554d7ff56993f5019eb90fe4ddf1e2e7 (diff) | |
parent | 7ad6899bf987a8ee615efbcfc99562457f89cd8b (diff) | |
download | stable-diffusion-webui-gfx803-9c6ea5386b568f72fc8f539c7f3c90053fd64e4a.tar.gz stable-diffusion-webui-gfx803-9c6ea5386b568f72fc8f539c7f3c90053fd64e4a.tar.bz2 stable-diffusion-webui-gfx803-9c6ea5386b568f72fc8f539c7f3c90053fd64e4a.zip |
Merge pull request #14504 from akx/you-spin-me-round
torch_bgr_to_pil_image: round, don't truncate
-rw-r--r-- | modules/upscaler_utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/upscaler_utils.py b/modules/upscaler_utils.py index e4c63f09..4f1417cf 100644 --- a/modules/upscaler_utils.py +++ b/modules/upscaler_utils.py @@ -30,7 +30,7 @@ def torch_bgr_to_pil_image(tensor: torch.Tensor) -> Image.Image: # TODO: is `tensor.float().cpu()...numpy()` the most efficient idiom? arr = tensor.float().cpu().clamp_(0, 1).numpy() # clamp arr = 255.0 * np.moveaxis(arr, 0, 2) # CHW to HWC, rescale - arr = arr.astype(np.uint8) + arr = arr.round().astype(np.uint8) arr = arr[:, :, ::-1] # flip BGR to RGB return Image.fromarray(arr, "RGB") |