Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in GuidedFilter(FaceParsing) Node: No Attribute 'guidedFilter' #4

Open
Poukpalaova opened this issue Feb 20, 2024 · 5 comments
Open

Comments

@Poukpalaova
Copy link

Poukpalaova commented Feb 20, 2024

Description

Encountered an error while executing the GuidedFilter(FaceParsing) node within a workflow shared in another post, which includes a comparison operation. It's unclear what should be provided in the guide input of that node. Also, what is the version of opencv-contrib-python to be used? In the requirements.txt there is no version therefore the latest is installing (4.9.0.80).

Error Message:

The following error message is received when executing the node:
Error occurred when executing GuidedFilter(FaceParsing):

module 'cv2.ximgproc' has no attribute 'guidedFilter'

Traceback (most recent call last):
File "M:\AIgenerated\StableDiffusion\ComfyUI2\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "M:\AIgenerated\StableDiffusion\ComfyUI2\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "M:\AIgenerated\StableDiffusion\ComfyUI2\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "M:\AIgenerated\StableDiffusion\ComfyUI2\custom_nodes\comfyui_face_parsing\face_parsing_nodes.py", line 923, in guided_filter
result_cv2 = cv2.ximgproc.guidedFilter(guide_cv2, image_cv2, radius, eps)
AttributeError: module 'cv2.ximgproc' has no attribute 'guidedFilter'

Console output:

ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
File "M:\AIgenerated\StableDiffusion\ComfyUI2\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "M:\AIgenerated\StableDiffusion\ComfyUI2\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "M:\AIgenerated\StableDiffusion\ComfyUI2\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "M:\AIgenerated\StableDiffusion\ComfyUI2\custom_nodes\comfyui_face_parsing\face_parsing_nodes.py", line 923, in guided_filter
result_cv2 = cv2.ximgproc.guidedFilter(guide_cv2, image_cv2, radius, eps)
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'cv2.ximgproc' has no attribute 'guidedFilter'

Prompt executed in 0.05 seconds

Environment

ComfyUI version: (specify the version if known)
Python version: 3.11.6
CUDA/CuDNN version: cudnn 12.1
Hardware specs:
VRAM: 24563 MB
RAM: 32693 MB
GPU: NVIDIA GeForce RTX 4090
Additional Libraries:
torch: 2.1.2+cu121
torchaudio: 2.1.2+cu121
torchmetrics: 1.3.0.post0
torchsde: 0.2.6
torchvision: 0.16.2+cu121
xformers: 0.0.23.post1
opencv-contrib-python: 4.9.0.80
opencv-python: 4.9.0.80
opencv-python-headless: 4.7.0.72

Steps to Reproduce

-Normal installation of ComfyUI (non-portable version).
-Execute the GuidedFilter(FaceParsing) node with the mentioned configuration.
-Encounter the attribute error regarding 'cv2.ximgproc'.

Expected Behavior

GuidedFilter should execute without errors, processing the inputs as intended.

Actual Behavior

The execution fails due to the missing 'guidedFilter' attribute in 'cv2.ximgproc'.

@Ryuukeisyou
Copy link
Owner

the version of opencv-contrib-python is fine. i guess it's probabaly because of the installation of other versions of opencv, as mentioned in readme. please try uninstalling and reinstalling and see if it work.

@LushLushh
Copy link

LushLushh commented Mar 19, 2024

I have the same problem. in the example workflow there's nothing inside the guide input; https://github.com/Ryuukeisyou/comfyui_face_parsing/blob/main/demo/workflow.png
What type of input does it expect?

GuidedFilter(FaceParsing) node

@Ryuukeisyou
Copy link
Owner

I have the same problem. in the example workflow there's nothing inside the guide input; https://github.com/Ryuukeisyou/comfyui_face_parsing/blob/main/demo/workflow.png What type of input does it expect?

GuidedFilter(FaceParsing) node

as far as i know the guide can be an image to guide the filter but i dont fully understand the mechanism of the algorithm. by default, if you leave the input empty it will use the input image as guide and this seem to work fine.

@soyatlas
Copy link

I run making a downgrade this library:

opencv-contrib.python: 4.7.0.72
opencv-python: 4.7.0.72
opencv-python-headless: 4.7.0.72

Hope solve it.

@pandayummy
Copy link

pip install opencv-contrib-python==4.9.0.80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants