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
d70b0bc4
Commit
d70b0bc4
authored
Aug 29, 2023
by
comfyanonymous
Browse files
Use the GPU for the canny preprocessor when available.
parent
81d9200e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
comfy_extras/nodes_canny.py
comfy_extras/nodes_canny.py
+3
-3
No files found.
comfy_extras/nodes_canny.py
View file @
d70b0bc4
...
...
@@ -3,7 +3,7 @@ import math
import
torch
import
torch.nn.functional
as
F
import
comfy.model_management
def
get_canny_nms_kernel
(
device
=
None
,
dtype
=
None
):
"""Utility function that returns 3x3 kernels for the Canny Non-maximal suppression."""
...
...
@@ -290,8 +290,8 @@ class Canny:
CATEGORY
=
"image/preprocessors"
def
detect_edge
(
self
,
image
,
low_threshold
,
high_threshold
):
output
=
canny
(
image
.
movedim
(
-
1
,
1
),
low_threshold
,
high_threshold
)
img_out
=
output
[
1
].
repeat
(
1
,
3
,
1
,
1
).
movedim
(
1
,
-
1
)
output
=
canny
(
image
.
to
(
comfy
.
model_management
.
get_torch_device
()).
movedim
(
-
1
,
1
),
low_threshold
,
high_threshold
)
img_out
=
output
[
1
].
cpu
().
repeat
(
1
,
3
,
1
,
1
).
movedim
(
1
,
-
1
)
return
(
img_out
,)
NODE_CLASS_MAPPINGS
=
{
...
...
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