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
133dc335
Commit
133dc335
authored
Apr 19, 2024
by
comfyanonymous
Browse files
Faster blur.
parent
5d08802f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
comfy_extras/nodes_post_processing.py
comfy_extras/nodes_post_processing.py
+3
-1
No files found.
comfy_extras/nodes_post_processing.py
View file @
133dc335
...
@@ -5,6 +5,7 @@ from PIL import Image
...
@@ -5,6 +5,7 @@ from PIL import Image
import
math
import
math
import
comfy.utils
import
comfy.utils
import
comfy.model_management
class
Blend
:
class
Blend
:
...
@@ -102,6 +103,7 @@ class Blur:
...
@@ -102,6 +103,7 @@ class Blur:
if
blur_radius
==
0
:
if
blur_radius
==
0
:
return
(
image
,)
return
(
image
,)
image
=
image
.
to
(
comfy
.
model_management
.
get_torch_device
())
batch_size
,
height
,
width
,
channels
=
image
.
shape
batch_size
,
height
,
width
,
channels
=
image
.
shape
kernel_size
=
blur_radius
*
2
+
1
kernel_size
=
blur_radius
*
2
+
1
...
@@ -112,7 +114,7 @@ class Blur:
...
@@ -112,7 +114,7 @@ class Blur:
blurred
=
F
.
conv2d
(
padded_image
,
kernel
,
padding
=
kernel_size
//
2
,
groups
=
channels
)[:,:,
blur_radius
:
-
blur_radius
,
blur_radius
:
-
blur_radius
]
blurred
=
F
.
conv2d
(
padded_image
,
kernel
,
padding
=
kernel_size
//
2
,
groups
=
channels
)[:,:,
blur_radius
:
-
blur_radius
,
blur_radius
:
-
blur_radius
]
blurred
=
blurred
.
permute
(
0
,
2
,
3
,
1
)
blurred
=
blurred
.
permute
(
0
,
2
,
3
,
1
)
return
(
blurred
,)
return
(
blurred
.
to
(
comfy
.
model_management
.
intermediate_device
())
,)
class
Quantize
:
class
Quantize
:
def
__init__
(
self
):
def
__init__
(
self
):
...
...
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