Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
94fceb87
"git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "8fe6209d5806a19dab47d740fc93ec26a88e859e"
Commit
94fceb87
authored
Aug 14, 2023
by
comfyanonymous
Browse files
Make Blur node use the image device for processing.
parent
e7d88855
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
comfy_extras/nodes_post_processing.py
comfy_extras/nodes_post_processing.py
+3
-3
No files found.
comfy_extras/nodes_post_processing.py
View file @
94fceb87
...
...
@@ -59,8 +59,8 @@ class Blend:
def
g
(
self
,
x
):
return
torch
.
where
(
x
<=
0.25
,
((
16
*
x
-
12
)
*
x
+
4
)
*
x
,
torch
.
sqrt
(
x
))
def
gaussian_kernel
(
kernel_size
:
int
,
sigma
:
float
):
x
,
y
=
torch
.
meshgrid
(
torch
.
linspace
(
-
1
,
1
,
kernel_size
),
torch
.
linspace
(
-
1
,
1
,
kernel_size
),
indexing
=
"ij"
)
def
gaussian_kernel
(
kernel_size
:
int
,
sigma
:
float
,
device
=
None
):
x
,
y
=
torch
.
meshgrid
(
torch
.
linspace
(
-
1
,
1
,
kernel_size
,
device
=
device
),
torch
.
linspace
(
-
1
,
1
,
kernel_size
,
device
=
device
),
indexing
=
"ij"
)
d
=
torch
.
sqrt
(
x
*
x
+
y
*
y
)
g
=
torch
.
exp
(
-
(
d
*
d
)
/
(
2.0
*
sigma
*
sigma
))
return
g
/
g
.
sum
()
...
...
@@ -101,7 +101,7 @@ class Blur:
batch_size
,
height
,
width
,
channels
=
image
.
shape
kernel_size
=
blur_radius
*
2
+
1
kernel
=
gaussian_kernel
(
kernel_size
,
sigma
).
repeat
(
channels
,
1
,
1
).
unsqueeze
(
1
)
kernel
=
gaussian_kernel
(
kernel_size
,
sigma
,
device
=
image
.
device
).
repeat
(
channels
,
1
,
1
).
unsqueeze
(
1
)
image
=
image
.
permute
(
0
,
3
,
1
,
2
)
# Torch wants (B, C, H, W) we use (B, H, W, C)
padded_image
=
F
.
pad
(
image
,
(
blur_radius
,
blur_radius
,
blur_radius
,
blur_radius
),
'reflect'
)
...
...
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