Fixing bug where width and height are inverted for control image resizing (#707)
This commit is contained in:
@@ -377,8 +377,8 @@ class Flux2Model(BaseModel):
|
|||||||
"match_target_res", False
|
"match_target_res", False
|
||||||
):
|
):
|
||||||
ratio = control_img.shape[2] / control_img.shape[3]
|
ratio = control_img.shape[2] / control_img.shape[3]
|
||||||
c_width = math.sqrt(control_image_res * ratio)
|
c_height = math.sqrt(control_image_res * ratio)
|
||||||
c_height = c_width / ratio
|
c_width = c_height / ratio
|
||||||
|
|
||||||
c_width = round(c_width / 32) * 32
|
c_width = round(c_width / 32) * 32
|
||||||
c_height = round(c_height / 32) * 32
|
c_height = round(c_height / 32) * 32
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ class QwenImageEditModel(QwenImageModel):
|
|||||||
# images are always run through at 1MP, based on diffusers inference code.
|
# images are always run through at 1MP, based on diffusers inference code.
|
||||||
target_area = 1024 * 1024
|
target_area = 1024 * 1024
|
||||||
ratio = control_images.shape[2] / control_images.shape[3]
|
ratio = control_images.shape[2] / control_images.shape[3]
|
||||||
width = math.sqrt(target_area * ratio)
|
height = math.sqrt(target_area * ratio)
|
||||||
height = width / ratio
|
width = height / ratio
|
||||||
|
|
||||||
width = round(width / 32) * 32
|
width = round(width / 32) * 32
|
||||||
height = round(height / 32) * 32
|
height = round(height / 32) * 32
|
||||||
|
|||||||
@@ -176,8 +176,8 @@ class QwenImageEditPlusModel(QwenImageModel):
|
|||||||
for i in range(len(control_images)):
|
for i in range(len(control_images)):
|
||||||
# control images are 0 - 1 scale, shape (bs, ch, height, width)
|
# control images are 0 - 1 scale, shape (bs, ch, height, width)
|
||||||
ratio = control_images[i].shape[2] / control_images[i].shape[3]
|
ratio = control_images[i].shape[2] / control_images[i].shape[3]
|
||||||
width = math.sqrt(CONDITION_IMAGE_SIZE * ratio)
|
height = math.sqrt(CONDITION_IMAGE_SIZE * ratio)
|
||||||
height = width / ratio
|
width = height / ratio
|
||||||
|
|
||||||
width = round(width / 32) * 32
|
width = round(width / 32) * 32
|
||||||
height = round(height / 32) * 32
|
height = round(height / 32) * 32
|
||||||
@@ -264,8 +264,8 @@ class QwenImageEditPlusModel(QwenImageModel):
|
|||||||
if len(control_img.shape) == 3:
|
if len(control_img.shape) == 3:
|
||||||
control_img = control_img.unsqueeze(0)
|
control_img = control_img.unsqueeze(0)
|
||||||
ratio = control_img.shape[2] / control_img.shape[3]
|
ratio = control_img.shape[2] / control_img.shape[3]
|
||||||
c_width = math.sqrt(control_image_res * ratio)
|
c_height = math.sqrt(control_image_res * ratio)
|
||||||
c_height = c_width / ratio
|
c_width = c_height / ratio
|
||||||
|
|
||||||
c_width = round(c_width / 32) * 32
|
c_width = round(c_width / 32) * 32
|
||||||
c_height = round(c_height / 32) * 32
|
c_height = round(c_height / 32) * 32
|
||||||
|
|||||||
Reference in New Issue
Block a user