From bf5ea244a8a02536cb17ef3f064b0ce8e41f2fcb Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 5 Dec 2023 09:26:55 -0500 Subject: [PATCH] add hdr settings to metadata --- CHANGELOG.md | 1 + modules/processing_correction.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbc1784db..7e57de16e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ indexes all networks on first access instead of server startup - disable google fonts check on server startup - fix torchvision/basicsr compatibility + - add hdr settings to metadata ## Update for 2023-12-04 diff --git a/modules/processing_correction.py b/modules/processing_correction.py index 704805db4..3e8d6994e 100644 --- a/modules/processing_correction.py +++ b/modules/processing_correction.py @@ -54,10 +54,13 @@ def maximize_tensor(input_tensor, boundary=1.0, channels=[0, 1, 2]): # pylint: d def correction_callback(p, timestep, kwags): if timestep > 950 and p.hdr_clamp: + p.extra_generation_params["HDR clamp"] = f'{p.hdr_threshold}/{p.hdr_boundary}' kwags["latents"] = soft_clamp_tensor(kwags["latents"], threshold=p.hdr_threshold, boundary=p.hdr_boundary) if timestep > 700 and p.hdr_center: + p.extra_generation_params["HDR center"] = f'{p.hdr_channel_shift}/{p.hdr_full_shift}' kwags["latents"] = center_tensor(kwags["latents"], channel_shift=p.hdr_channel_shift, full_shift=p.hdr_full_shift) if timestep > 1 and timestep < 100 and p.hdr_maximize: + p.extra_generation_params["HDR max"] = f'{p.hdr_max_center}/p.hdr_max_boundry' kwags["latents"] = center_tensor(kwags["latents"], channel_shift=p.hdr_max_center, full_shift=1.0) kwags["latents"] = maximize_tensor(kwags["latents"], boundary=p.hdr_max_boundry) return kwags