TaiTair / comfyui-simswap

Simswap node for ComfyUI
GNU General Public License v3.0
9 stars 1 forks source link

AttributeError: object has no attribute 'shape' #2

Open tokenwizard opened 2 months ago

tokenwizard commented 2 months ago

I've cloned the repo and downloaded all the required models/files. When I try to run and image through simswap in ComfyUI, It fails with this error below:


[Simswap] 11:13:39 - STATUS - Working: source face index [0], target face index [0]
[Simswap] 11:13:39 - STATUS - Using Loaded Source Face Model...
[Simswap] 11:13:39 - STATUS - Using Hashed Target Face(s) Model...
[Simswap] 11:13:39 - STATUS - Swapping...
(142, 366, 4)
find model: /run/media/tokenwizard/AI-Stuff/ComfyUI/models/simswap/antelope/glintr100.onnx recognition
find model: /run/media/tokenwizard/AI-Stuff/ComfyUI/models/simswap/antelope/scrfd_10g_bnkps.onnx detection
set det-size: (640, 640)
!!! Exception during processing!!! 'NoneType' object has no attribute 'shape'
Traceback (most recent call last):
  File "/run/media/tokenwizard/AI-Stuff/ComfyUI/execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/tokenwizard/AI-Stuff/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 "/run/media/tokenwizard/AI-Stuff/ComfyUI/execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/tokenwizard/AI-Stuff/ComfyUI/custom_nodes/comfyui-simswap/nodes.py", line 309, in execute
    script.process(
  File "/run/media/tokenwizard/AI-Stuff/ComfyUI/custom_nodes/comfyui-simswap/scripts/simswap_faceswap.py", line 95, in process
    result = swap_face(
             ^^^^^^^^^^
  File "/run/media/tokenwizard/AI-Stuff/ComfyUI/custom_nodes/comfyui-simswap/scripts/simswap_swapper.py", line 353, in swap_face
    img_a_align_crop, _ = app.get(img_a_whole,crop_size)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/tokenwizard/AI-Stuff/ComfyUI/custom_nodes/comfyui-simswap/scripts/insightface_func/face_detect_crop_single.py", line 64, in get
    bboxes, kpss = self.det_model.detect(img,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/tokenwizard/AI-Stuff/ComfyUI/venv/lib/python3.12/site-packages/insightface/model_zoo/retinaface.py", line 211, in detect
    im_ratio = float(img.shape[0]) / img.shape[1]
                     ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'
TaiTair commented 2 months ago

Can I see your workflow by any chance?

tokenwizard commented 2 months ago

I'm just using this Load Images from folder to load images sequentially into Simswap and then outputting the swapped image for each.

I have this exact same workflow with a Reactor Node instead of Simswap and it works fine. Maybe Simswap doesn't like loading from this Image Folder node?

image

tokenwizard commented 2 months ago

Ok, yes. It does seem to work with a single image supplied to it, from a Load Image node. But that Load Images from Folder doesn't play well with it, unfortunately.

TaiTair commented 2 months ago

Ah I know what the issue is :). Use an image list to image batch node between simswap and the load image from folder. It doesn't like lists.