SamKhoze/ComfyUI-DeepFuze

failed to load file with cv

Rvage0815 opened this issue · 2 comments

while the files are save to the comfyui temp folder, the source image and the target image, also a video file for some reason, there are several error messages in the command prompt. everything required is installed as far as i know, i followed your instruction but i dont get this to work. please help me to figure this out :) the complete process is listed below. i used a single image but tried it with a video file too.

video h265-mp4
{'enhancer': 'gfpgan_1.4', 'faceswap_model': 'inswapper_128', 'frame_enhancer': 'ultra_sharp_x4', 'face_detector_model': 'retinaface', 'reference_face_index': 0, 'face_mask_padding_left': 0, 'face_mask_padding_right': 0, 'face_mask_padding_bottom': 0, 'face_mask_padding_top': 0, 'device': 'cpu', 'frame_rate': 1.0, 'loop_count': 0, 'filename_prefix': 'deepfuze', 'pingpong': False, 'save_output': True, 'source_images': ['879', 0], 'target_images': ['883', 0], 'format': 'video/h265-mp4', 'pix_fmt': 'yuv420p10le', 'crf': 22, 'save_metadata': ['save_metadata', 'BOOLEAN', {'default': True}]}
D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite\videohelpersuite..\video_formats\h265-mp4.json
pix_fmt
crf
save_metadata
['python', './run.py', '--frame-processors', 'face_swapper', '-s', 'D:\AI\ComfyUI_windows_portable\ComfyUI\output\deepfuze_00007_.png', '-t', 'D:\AI\ComfyUI_windows_portable\ComfyUI\output\deepfuze_00007.mp4', '--face-detector-model', 'retinaface', '-o', 'D:\AI\ComfyUI_windows_portable\ComfyUI\output\deepfuze\faceswap_1719183553317289.mp4', '--face-swapper-model', 'inswapper_128', '--reference-face-position', '0', '--face-mask-padding', '0', '0', '0', '0', '--headless']
Traceback (most recent call last):
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze\run.py", line 10, in
core.cli()
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze.\deepfuze\core.py", line 112, in cli
run(program)
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze.\deepfuze\core.py", line 227, in run
conditional_process()
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze.\deepfuze\core.py", line 265, in conditional_process
conditional_append_reference_faces()
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze.\deepfuze\core.py", line 284, in conditional_append_reference_faces
abstract_reference_frame = frame_processor_module.get_reference_frame(source_face, reference_face, reference_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze.\deepfuze\processors\frame\modules\face_swapper.py", line 311, in get_reference_frame
return swap_face(source_face, target_face, temp_vision_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze.\deepfuze\processors\frame\modules\face_swapper.py", line 241, in swap_face
crop_vision_frame = apply_swap(source_face, crop_vision_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze.\deepfuze\processors\frame\modules\face_swapper.py", line 252, in apply_swap
frame_processor = get_frame_processor()
^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze.\deepfuze\processors\frame\modules\face_swapper.py", line 105, in get_frame_processor
FRAME_PROCESSOR = onnxruntime.InferenceSession(model_path, providers = apply_execution_provider_options(deepfuze.globals.execution_device_id, deepfuze.globals.execution_providers))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "D:\AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 472, in _create_inference_session
sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxruntime.capi.onnxruntime_pybind11_state.InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from D:\AI\ComfyUI_windows_portable\ComfyUI\models\deepfuze\inswapper_128.onnx failed:Protobuf parsing failed.
['python', './run.py', '--frame-processors', 'face_enhancer', '--face-enhancer-model', 'gfpgan_1.4', '-t', 'D:\AI\ComfyUI_windows_portable\ComfyUI\output\deepfuze\faceswap_1719183553317289.mp4', '-o', 'D:\AI\ComfyUI_windows_portable\ComfyUI\output\deepfuze\faceswap_1719183553317289.mp4', '--headless']
[DEEPFUZE.PROCESSORS.FRAME.MODULES.FACE_ENHANCER] Select a image or video for target path!
['python', './run.py', '--frame-processors', 'frame_enhancer', '--frame-enhancer-model', 'ultra_sharp_x4', '-t', 'D:\AI\ComfyUI_windows_portable\ComfyUI\output\deepfuze\faceswap_1719183553317289.mp4', '-o', 'D:\AI\ComfyUI_windows_portable\ComfyUI\output\deepfuze\faceswap_1719183553317289.mp4', '--headless']
[DEEPFUZE.PROCESSORS.FRAME.MODULES.FRAME_ENHANCER] Select a image or video for target path!
None
None
!!! Exception during processing!!! D:\AI\ComfyUI_windows_portable\ComfyUI\output\deepfuze\faceswap_1719183553317289.mp4 could not be loaded with cv.
Traceback (most recent call last):
File "D:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze\nodes.py", line 1018, in faceswampgenerate
return load_video_cv(faceswap_filename,0,'Disabled',512,512,0,0,1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze\nodes.py", line 543, in load_video_cv
(width, height, fps, duration, total_frames, target_frame_time) = next(gen)
^^^^^^^^^
File "D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DeepFuze\nodes.py", line 462, in cv_frame_generator
raise ValueError(f"{video} could not be loaded with cv.")
ValueError: D:\AI\ComfyUI_windows_portable\ComfyUI\output\deepfuze\faceswap_1719183553317289.mp4 could not be loaded with cv.

Prompt executed in 25.19 seconds

looks like the ONNXRuntimeError] : 7 : INVALID_PROTOBUF is the problem but everything is updated and the requirements are installed too, maybe a wrong version?

found the mistake.
first i uninstalled onnx-runtime-gpu:

  • python_embeded\python.exe -m pip uninstall onnxruntime-gpu

reinstalled it:

  • python_embeded\python.exe -m pip install onnxruntime-gpu

after that a missing DLL was reported:

  • found a Fix here ^^

I was able to find a copy of the missing zlib DLL in the NVIDIA Nsight directory:
C:\Program Files\NVIDIA Corporation\Nsight Systems 2022.4.2\host-windows-x64\zlib.dll

I copied and renamed it to:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\zlibwapi.dll

now it works :P