Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
bb2faa5f
Commit
bb2faa5f
authored
Aug 30, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
applied fill to all but one inpainting modes, fixed issue with mask resizing
parent
ff98e09d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
webui.py
webui.py
+16
-13
No files found.
webui.py
View file @
bb2faa5f
...
@@ -1145,27 +1145,16 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
...
@@ -1145,27 +1145,16 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
self
.
sampler
=
samplers_for_img2img
[
self
.
sampler_index
]
.
constructor
()
self
.
sampler
=
samplers_for_img2img
[
self
.
sampler_index
]
.
constructor
()
if
self
.
original_mask
is
not
None
:
if
self
.
original_mask
is
not
None
:
if
self
.
mask_blur
>
0
:
self
.
original_mask
=
resize_image
(
self
.
resize_mode
,
self
.
original_mask
,
self
.
width
,
self
.
height
)
self
.
original_mask
=
self
.
original_mask
.
filter
(
ImageFilter
.
GaussianBlur
(
self
.
mask_blur
))
.
convert
(
'L'
)
latmask
=
self
.
original_mask
.
convert
(
'RGB'
)
.
resize
((
64
,
64
))
latmask
=
np
.
moveaxis
(
np
.
array
(
latmask
,
dtype
=
np
.
float
),
2
,
0
)
/
255
latmask
=
latmask
[
0
]
latmask
=
np
.
tile
(
latmask
[
None
],
(
4
,
1
,
1
))
self
.
mask
=
torch
.
asarray
(
1.0
-
latmask
)
.
to
(
device
)
.
type
(
sd_model
.
dtype
)
self
.
nmask
=
torch
.
asarray
(
latmask
)
.
to
(
device
)
.
type
(
sd_model
.
dtype
)
self
.
overlay_images
=
[]
self
.
overlay_images
=
[]
imgs
=
[]
imgs
=
[]
for
img
in
self
.
init_images
:
for
img
in
self
.
init_images
:
image
=
img
.
convert
(
"RGB"
)
image
=
img
.
convert
(
"RGB"
)
image
=
resize_image
(
self
.
resize_mode
,
image
,
self
.
width
,
self
.
height
)
image
=
resize_image
(
self
.
resize_mode
,
image
,
self
.
width
,
self
.
height
)
if
self
.
original_mask
is
not
None
:
if
self
.
original_mask
is
not
None
:
if
self
.
inpainting_fill
==
0
:
if
self
.
inpainting_fill
!=
1
:
image
=
fill
(
image
,
self
.
original_mask
)
image
=
fill
(
image
,
self
.
original_mask
)
image_masked
=
Image
.
new
(
'RGBa'
,
(
image
.
width
,
image
.
height
))
image_masked
=
Image
.
new
(
'RGBa'
,
(
image
.
width
,
image
.
height
))
...
@@ -1194,6 +1183,20 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
...
@@ -1194,6 +1183,20 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
self
.
init_latent
=
sd_model
.
get_first_stage_encoding
(
sd_model
.
encode_first_stage
(
image
))
self
.
init_latent
=
sd_model
.
get_first_stage_encoding
(
sd_model
.
encode_first_stage
(
image
))
if
self
.
original_mask
is
not
None
:
if
self
.
mask_blur
>
0
:
self
.
original_mask
=
self
.
original_mask
.
filter
(
ImageFilter
.
GaussianBlur
(
self
.
mask_blur
))
.
convert
(
'L'
)
latmask
=
self
.
original_mask
.
convert
(
'RGB'
)
.
resize
((
self
.
init_latent
.
shape
[
3
],
self
.
init_latent
.
shape
[
2
]))
latmask
=
np
.
moveaxis
(
np
.
array
(
latmask
,
dtype
=
np
.
float
),
2
,
0
)
/
255
latmask
=
latmask
[
0
]
latmask
=
np
.
tile
(
latmask
[
None
],
(
4
,
1
,
1
))
self
.
mask
=
torch
.
asarray
(
1.0
-
latmask
)
.
to
(
device
)
.
type
(
sd_model
.
dtype
)
self
.
nmask
=
torch
.
asarray
(
latmask
)
.
to
(
device
)
.
type
(
sd_model
.
dtype
)
def
sample
(
self
,
x
,
conditioning
,
unconditional_conditioning
):
def
sample
(
self
,
x
,
conditioning
,
unconditional_conditioning
):
t_enc
=
int
(
min
(
self
.
denoising_strength
,
0.999
)
*
self
.
steps
)
t_enc
=
int
(
min
(
self
.
denoising_strength
,
0.999
)
*
self
.
steps
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment