From ff098df38414f445826539e05469e33845bcd9e9 Mon Sep 17 00:00:00 2001 From: changjiaxiang Date: Thu, 5 Sep 2024 13:53:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=92=E4=B8=80=E5=8C=96?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E5=80=BC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index 5e9580f..e38594e 100644 --- a/__init__.py +++ b/__init__.py @@ -1629,7 +1629,7 @@ class NormalizationNumber: "input_min": ("FLOAT", {"default": 0.1, "min": 0.0, "max": 1.0, "step": 0.01}), "input_max": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}), "target_min": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01}), - "target_mid": ("FLOAT", {"default": 0.6, "min": 0.0, "max": 1.0, "step": 0.01}), + "target_mid": ("FLOAT", {"default": 0.1, "min": 0.0, "max": 1.0, "step": 0.01}), "target_max": ("FLOAT", {"default": 0.7, "min": 0.0, "max": 1.0, "step": 0.01}), }, } @@ -1646,7 +1646,8 @@ class NormalizationNumber: input_value = input_min if input_value > input_max: input_value = input_max - + if target_mid > target_max or target_mid < target_min: + target_mid = (target_max - target_min)/2 if input_value <= half_input_max: # 映射 (input_min ~ 0.5 * input_max) 到 (target_min ~ target_mid) normalized_value = (input_value - input_min) / (half_input_max - input_min)