fix(backend): do not round image dims to 64 in controlnet processor resize

Rounding the dims results in control images that are subtly different than the input. We round to the nearest 8px later, there's no need to round now.
This commit is contained in:
psychedelicious 2024-04-29 22:38:05 +10:00 committed by Kent Keirsey
parent ebeae41cb2
commit 2d7b8c2a1b

View File

@ -144,10 +144,8 @@ def resize_image_to_resolution(input_image: np.ndarray, resolution: int) -> np.n
h = float(input_image.shape[0])
w = float(input_image.shape[1])
scaling_factor = float(resolution) / min(h, w)
h *= scaling_factor
w *= scaling_factor
h = int(np.round(h / 64.0)) * 64
w = int(np.round(w / 64.0)) * 64
h = int(h * scaling_factor)
w = int(w * scaling_factor)
if scaling_factor > 1:
return cv2.resize(input_image, (w, h), interpolation=cv2.INTER_LANCZOS4)
else: