Unverified Commit df476d9f authored by raven's avatar raven Committed by GitHub
Browse files

[Docs] Fix a code example in the ControlNet Inpainting documentation (#6236)

fix document on masked image in inpainting controlnet
parent 3e71a206
...@@ -203,7 +203,7 @@ def make_inpaint_condition(image, image_mask): ...@@ -203,7 +203,7 @@ def make_inpaint_condition(image, image_mask):
image_mask = np.array(image_mask.convert("L")).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] assert image.shape[0:1] == image_mask.shape[0:1]
image[image_mask > 0.5] = 1.0 # set as masked pixel image[image_mask > 0.5] = -1.0 # set as masked pixel
image = np.expand_dims(image, 0).transpose(0, 3, 1, 2) image = np.expand_dims(image, 0).transpose(0, 3, 1, 2)
image = torch.from_numpy(image) image = torch.from_numpy(image)
return image return image
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment