You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So far, this guide has used inpaint specific checkpoints such as [runwayml/stable-diffusion-inpainting](https://huggingface.co/runwayml/stable-diffusion-inpainting). But you can also use regular checkpoints like [runwayml/stable-diffusion-v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5). Let's compare the results of the two checkpoints.
190
+
191
+
The image on the left is generated from a regular checkpoint, and the image on the right is from an inpaint checkpoint. You'll immediately notice the image on the left is not as clean, and you can still see the outline of the area the model is supposed to inpaint. The image on the right is much cleaner and the inpainted area appears more natural.
192
+
193
+
<hfoptionsid="regular-specific">
194
+
<hfoptionid="runwayml/stable-diffusion-v1-5">
195
+
196
+
```py
197
+
import torch
198
+
from diffusers import AutoPipelineForInpainting
199
+
from diffusers.utils import load_image, make_image_grid
However, for more basic tasks like erasing an object from an image (like the rocks in the road for example), a regular checkpoint yields pretty good results. There isn't as noticeable of difference between the regular and inpaint checkpoint.
258
+
259
+
<hfoptionsid="inpaint">
260
+
<hfoptionid="runwayml/stable-diffusion-v1-5">
261
+
262
+
```py
263
+
import torch
264
+
from diffusers import AutoPipelineForInpainting
265
+
from diffusers.utils import load_image, make_image_grid
The trade-off of using a non-inpaint specific checkpoint is the overall image quality may be lower, but it generally tends to preserve the mask area (that is why you can see the mask outline). The inpaint specific checkpoints are intentionally trained to generate higher quality inpainted images, and that includes creating a more natural transition between the masked and unmasked areas. As a result, these checkpoints are more likely to change your unmasked area.
320
+
321
+
If preserving the unmasked area is important for your task, you can use the code below to force the unmasked area of an image to remain the same at the expense of some more unnatural transitions between the masked and unmasked areas.
322
+
323
+
```py
324
+
importPIL
325
+
import numpy as np
326
+
import torch
327
+
328
+
from diffusers import AutoPipelineForInpainting
329
+
from diffusers.utils import load_image, make_image_grid
Image features - like quality and "creativity" - are dependent on pipeline parameters. Knowing what these parameters do is important for getting the results you want. Let's take a look at the most important parameters and see how changing them affects the output.
The [`AutoPipelineForInpainting`] (and other inpainting pipelines) generally changes the unmasked parts of an image to create a more natural transition between the masked and unmasked region. If this behavior is undesirable, you can force the unmasked area to remain the same. However, forcing the unmasked portion of the image to remain the same may result in some unusual transitions between the unmasked and masked areas.
315
-
316
-
```py
317
-
importPIL
318
-
import numpy as np
319
-
import torch
320
-
321
-
from diffusers import AutoPipelineForInpainting
322
-
from diffusers.utils import load_image, make_image_grid
[`AutoPipelineForInpainting`] can be chained with other 🤗 Diffusers pipelines to edit their outputs. This is often useful for improving the output quality from your other diffusion pipelines, and if you're using multiple pipelines, it can be more memory-efficient to chain them together to keep the outputs in latent space and reuse the same pipeline components.
0 commit comments