Fix outpainting params (#1089)

This commit is contained in:
jinchen62
2023-02-24 14:41:32 -08:00
committed by GitHub
parent b6c14ad468
commit bae208bcc4
3 changed files with 10 additions and 6 deletions

View File

@@ -157,8 +157,8 @@ def outpaint_inf(
prompt,
negative_prompt,
image,
args.pixels,
args.mask_blur,
pixels,
mask_blur,
left,
right,
top,

View File

@@ -69,11 +69,13 @@ class OutpaintPipeline(StableDiffusionPipeline):
latents = latents * self.scheduler.init_noise_sigma
return latents
def prepare_mask_and_masked_image(self, image, mask, mask_blur):
def prepare_mask_and_masked_image(
self, image, mask, mask_blur, width, height
):
if mask_blur > 0:
mask = mask.filter(ImageFilter.GaussianBlur(mask_blur))
image = image.resize((512, 512))
mask = mask.resize((512, 512))
image = image.resize((width, height))
mask = mask.resize((width, height))
# preprocess image
if isinstance(image, (Image.Image, np.ndarray)):
@@ -478,7 +480,7 @@ class OutpaintPipeline(StableDiffusionPipeline):
# Preprocess mask and image
mask, masked_image = self.prepare_mask_and_masked_image(
image_to_process, mask_to_process, mask_blur
image_to_process, mask_to_process, mask_blur, width, height
)
# Prepare mask latent variables

View File

@@ -61,6 +61,7 @@ p.add_argument(
"--height",
type=int,
default=512,
choices=range(384, 768, 8),
help="the height of the output image.",
)
@@ -68,6 +69,7 @@ p.add_argument(
"--width",
type=int,
default=512,
choices=range(384, 768, 8),
help="the width of the output image.",
)