Gourieff / comfyui-reactor-node

Fast and Simple Face Swap Extension Node for ComfyUI
GNU General Public License v3.0
1.61k stars 159 forks source link

Error occurred when executing ReActorBuildFaceModel #442

Open yujun2019 opened 1 month ago

yujun2019 commented 1 month ago

First, confirm

What happened?

Error occurred when executing ReActorBuildFaceModel:

unsupported operand type(s) for +: 'NoneType' and 'NoneType'

File "D:\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ComfyUI\custom_nodes\comfyui-reactor-node\nodes.py", line 536, in blend_faces blended_embedding = np.mean(embeddings, axis=0) if compute_method == "Mean" else np.median(embeddings, axis=0) if compute_method == "Median" else stats.mode(embeddings, axis=0)[0].astype(np.float32) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ProgramData\Anaconda3\envs\sd\Lib\site-packages\numpy\core\fromnumeric.py", line 3504, in mean return _methods._mean(a, axis=axis, dtype=dtype, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ProgramData\Anaconda3\envs\sd\Lib\site-packages\numpy\core_methods.py", line 118, in _mean ret = umr_sum(arr, axis, dtype, out, keepdims, where=where)

Steps to reproduce the problem

{ "last_node_id": 50, "last_link_id": 68, "nodes": [ { "id": 4, "type": "LoadImage", "pos": [ 50, 430 ], "size": [ 320, 310 ], "flags": {}, "order": 0, "mode": 0, "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 4 ], "shape": 3, "slot_index": 0 }, { "name": "MASK", "type": "MASK", "links": null, "shape": 3 } ], "properties": { "Node name for S&R": "LoadImage" }, "widgets_values": [ "ПолинаГагарина01.jpg", "image" ] }, { "id": 6, "type": "LoadImage", "pos": [ 380, 430 ], "size": [ 320, 310 ], "flags": {}, "order": 1, "mode": 0, "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 5 ], "shape": 3, "slot_index": 0 }, { "name": "MASK", "type": "MASK", "links": null, "shape": 3 } ], "properties": { "Node name for S&R": "LoadImage" }, "widgets_values": [ "ОльгаКуриленко01.jpg", "image" ] }, { "id": 11, "type": "LoadImage", "pos": [ 710, 430 ], "size": [ 320, 310 ], "flags": {}, "order": 2, "mode": 0, "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 14 ], "shape": 3, "slot_index": 0 }, { "name": "MASK", "type": "MASK", "links": null, "shape": 3 } ], "properties": { "Node name for S&R": "LoadImage" }, "widgets_values": [ "ИринаАнтоненко02.jpg", "image" ] }, { "id": 5, "type": "ImpactMakeImageBatch", "pos": [ 490, 260 ], "size": { "0": 160, "1": 110 }, "flags": {}, "order": 5, "mode": 0, "inputs": [ { "name": "image1", "type": "IMAGE", "link": 3 }, { "name": "image2", "type": "IMAGE", "link": 4 }, { "name": "image3", "type": "IMAGE", "link": 5 }, { "name": "image4", "type": "IMAGE", "link": 14 }, { "name": "image5", "type": "IMAGE", "link": null } ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 6 ], "shape": 3, "slot_index": 0 } ], "properties": { "Node name for S&R": "ImpactMakeImageBatch" } }, { "id": 3, "type": "LoadImage", "pos": [ 50, 80 ], "size": [ 320, 310 ], "flags": {}, "order": 3, "mode": 0, "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 3, 67 ], "shape": 3, "slot_index": 0 }, { "name": "MASK", "type": "MASK", "links": null, "shape": 3 } ], "properties": { "Node name for S&R": "LoadImage" }, "widgets_values": [ "ПаулинаАндреева01.jpg", "image" ] }, { "id": 50, "type": "PreviewImage", "pos": [ 1520, 80 ], "size": [ 250, 330 ], "flags": {}, "order": 8, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", "link": 68 } ], "properties": { "Node name for S&R": "PreviewImage" } }, { "id": 47, "type": "Note", "pos": [ 710, 50 ], "size": [ 360, 160 ], "flags": {}, "order": 4, "mode": 0, "properties": { "text": "" }, "widgets_values": [ "save_mode - save a blended face model or not\nsend_only - if you already build the model and want to use with the main ReActor node but don't want to waste your time for rebuilding it when you run the queue again - set this option to YES \n\nMean (recommended) - Average value (best result 👍)\nMedian - Mid-point value (may be funny 😅)\nMode - Most common value (may be scary 😨)\n\nMean and Median will be similar if you load two images" ], "color": "#432", "bgcolor": "#653" }, { "id": 1, "type": "ReActorBuildFaceModel", "pos": [ 710, 260 ], "size": { "0": 315, "1": 130 }, "flags": {}, "order": 6, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", "link": 6, "slot_index": 0 } ], "outputs": [ { "name": "FACE_MODEL", "type": "FACE_MODEL", "links": [ 66 ], "shape": 3, "slot_index": 0 } ], "properties": { "Node name for S&R": "ReActorBuildFaceModel" }, "widgets_values": [ true, true, "test", "Mean" ] }, { "id": 49, "type": "ReActorFaceSwap", "pos": [ 1160, 80 ], "size": { "0": 315, "1": 338 }, "flags": {}, "order": 7, "mode": 0, "inputs": [ { "name": "input_image", "type": "IMAGE", "link": 67, "slot_index": 0 }, { "name": "source_image", "type": "IMAGE", "link": null }, { "name": "face_model", "type": "FACE_MODEL", "link": 66 } ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 68 ], "shape": 3, "slot_index": 0 }, { "name": "FACE_MODEL", "type": "FACE_MODEL", "links": null, "shape": 3 } ], "properties": { "Node name for S&R": "ReActorFaceSwap" }, "widgets_values": [ true, "inswapper_128.onnx", "retinaface_resnet50", "GFPGANv1.4.pth", 1, 0.5, "no", "no", "0", "0", 1 ] } ], "links": [ [ 3, 3, 0, 5, 0, "IMAGE" ], [ 4, 4, 0, 5, 1, "IMAGE" ], [ 5, 6, 0, 5, 2, "IMAGE" ], [ 6, 5, 0, 1, 0, "IMAGE" ], [ 14, 11, 0, 5, 3, "IMAGE" ], [ 66, 1, 0, 49, 2, "FACE_MODEL" ], [ 67, 3, 0, 49, 0, "IMAGE" ], [ 68, 49, 0, 50, 0, "IMAGE" ] ], "groups": [], "config": {}, "extra": {}, "version": 0.4 }

Sysinfo

Windows11 nvidia 4090

Relevant console log

[ReActor] 22:22:41 - STATUS - Blending with Compute Method 'Mean'...
!!! Exception during processing!!! unsupported operand type(s) for +: 'NoneType' and 'NoneType'
Traceback (most recent call last):
  File "D:\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\custom_nodes\comfyui-reactor-node\nodes.py", line 536, in blend_faces
    blended_embedding = np.mean(embeddings, axis=0) if compute_method == "Mean" else np.median(embeddings, axis=0) if compute_method == "Median" else stats.mode(embeddings, axis=0)[0].astype(np.float32)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\Anaconda3\envs\sd\Lib\site-packages\numpy\core\fromnumeric.py", line 3504, in mean
    return _methods._mean(a, axis=axis, dtype=dtype,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\Anaconda3\envs\sd\Lib\site-packages\numpy\core\_methods.py", line 118, in _mean
    ret = umr_sum(arr, axis, dtype, out, keepdims, where=where)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'

Additional information

No response

Gourieff commented 1 month ago

Missing the image file I suppose, according to the WF you use the filename of the image from the demo-wf, you should load your own image

yujun2019 commented 1 month ago

我终于找到原因了,原来是ComfyUI\models\insightface\models\buffalo_l 中的模型不完整,1k3d68.onnx 2d106det.onnx det_10g.onnx genderage.onnx w600k_r50.onnx ,缺少了 insightface 就没法正常工作。