TaiTair / comfyui-simswap

Simswap node for ComfyUI
GNU General Public License v3.0
15 stars 4 forks source link

When I change the swap_model, it still results in the same face. #3

Closed bloom-tomita closed 6 months ago

bloom-tomita commented 6 months ago

Thank you for the wonderful post. When I change the swap_model, it still results in the same face.

In the function swap_face found here: https://github.com/TaiTair/comfyui-simswap/blob/main/scripts/simswap_swapper.py#L196, it seems like the specified model is being passed into model.

However, looking here: https://github.com/TaiTair/comfyui-simswap/blob/main/scripts/simswap_swapper.py#L340, model = create_model(opt) seems to reinitialize the model, which suggests that the model specified in the arguments is not being used.

TaiTair commented 6 months ago

Hi there, I definitely did not experience that. For example, the quality of the swapped face was much better using Ghost rather than Simswap.

I understand what you are saying but if you look at the two files from which TestOptions is generated you will see that the variable opt doesn't have any parameters for the specific model. So I still believe it is using what is being passed by comfyui.

Take a look at these files for more details:
https://github.com/TaiTair/comfyui-simswap/blob/main/scripts/simswap/options/base_options.py
https://github.com/TaiTair/comfyui-simswap/blob/main/scripts/simswap/options/test_options.py

Also if you try to use the inswapper onnx files you'll see that it doesn't work because the tensors are different. Which does suggest that it is using the model you are selecting.

TaiTair commented 6 months ago

If you look here:
https://github.com/TaiTair/comfyui-simswap/blob/39e8bf7ae056824e424b5458e4f3b7677a9b6203/scripts/simswap_swapper.py#L99

That is where it is getting the model from comfyui.

And then if you look here: https://github.com/TaiTair/comfyui-simswap/blob/39e8bf7ae056824e424b5458e4f3b7677a9b6203/scripts/simswap_swapper.py#L196 or here: https://github.com/TaiTair/comfyui-simswap/blob/39e8bf7ae056824e424b5458e4f3b7677a9b6203/scripts/simswap_swapper.py#L432

You will see that the model is being passed to the function swap_face or swap_face_many and used that way.

Marking this as solved.