-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Controlnet inpainting change too much of masking area #7796
Comments
this is text 2 image controlnet pipeline before i use inpainting model without controlnet inpainting, but still got bad result how possible to get result like yours i will try your mask do you use output_image = pipe.image_processor.apply_overlay(mask_image1, input_image, output_image) i use your mask still # process mask
def make_inpaint_condition (image, image_mask):
image = np.array(image.convert("RGB")).astype(np.float32) / 255.0
image_mask = np.array(image_mask.convert("L")).astype(np.float32) / 255.0
assert image.shape[0:1] == image_mask.shape[0:1], "image and image_mask must have the same image size"
image[image_mask > 0.5] = -1.0 # set as masked pixel
image = np.expand_dims(image, 0).transpose(0, 3, 1, 2)
image = torch.from_numpy(image)
return image
# pipe
pipe = StableDiffusionControlNetPipeline.from_single_file(
'/home/zznet/workspace/stable-diffusion-webui/models/Stable-diffusion/realisticVisionV60B1_v51VAE.safetensors',
torch_dtype = torch.bfloat16,
controlnet = [
depth_control,
inpaint_control,
],
)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, use_karras_sigmas = True, algorithm_type = 'sde-dpmsolver++', euler_at_final = True)
pipe.enable_freeu(s1 = 0.9, s2 = 0.2, b1 = 1.2, b2 = 1.4)
pipe.to('cuda')
pipe.load_textual_inversion([
'easynegative.safetensors',
'./FastNegativeV2.pt'
], token = [
'wtf0',
'wtf1',
])
# sample
output_image = pipe(
image = [
depth_control,
inpaint_control,
],
prompt = prompt,
negative_prompt = 'wtf0, wtf1, dof, dummy, mannequin',
width = renderWidth,
height = renderHeight,
num_inference_steps = num_inference_steps,
guidance_scale = guidance_scale,
guidance_rescale = 0.5,
# generator = _generator,
clip_skip = 0,
controlnet_conditioning_scale = [
0.0, # disable for test
0.999,
],
).images[0]
# output_image = pipe.image_processor.apply_overlay(mask_image1, input_image, output_image) |
I'm literally using the the basics: base = load_image("original.jpeg")
mask = load_image("mask.png")
inpaint = pipe(
prompt,
width=1024,
height=1280,
image=base,
mask_image=mask,
guidance_scale=10,
strength=0.99,
num_inference_steps=50,
).images[0] Also as I don't see the need of controlnet, I'm using just Also I'm using SDXL that's why you see that the quality it's better too, even though I reduced a bit the image size so it doesn't take too long to generate. Edit: I now see with your edit that you're not using an inpainting model, probably that's your solution. |
re: Edit: I now see with your edit that you're not using an inpainting model, probably that's your solution. i did use inpainting model, but the mask area still changed, i will try again sd 1.5 inpainting with controlnet depth map sd 1.5 inpainting without controlnet depth map |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Describe the bug
mask
i got mask with this
if use apply mask still bad around edge
Because there are too many noise below, the one above cannot cover them.
is it possible to preserve mask area?
and below is when i use compel without DiffusersTextualInversionManager
the color changed, but it looks cloth is original
damian0815/compel#86
Reproduction
code from here
https://huggingface.co/docs/diffusers/en/using-diffusers/controlnet
Logs
System Info
0.27.2
Who can help?
No response
The text was updated successfully, but these errors were encountered: