machineminded / Fooocus-inswapper

Focus on prompting and generating with an inswapper integration
GNU General Public License v3.0
73 stars 14 forks source link

[Feature]Inswapper multi targeting mode: Allow source face image to also be selectable as an index as well as multiple targets per task #21

Open ujl123 opened 6 months ago

ujl123 commented 6 months ago

Is your feature request related to a problem? Please describe. This is a double feature ticket.

In Roop face swap in auto1111 there is a feature that allows you to create an array of faces from your source image, and use those to multi target faces in the target image Or just target 1 face (index 0). In the screenshot below you can see that source 0 will swap with target 1, source 2 will swap with target 0 and source 1 will swap with target 2. This is all done in 1 operation

image

In addition, this helps not having to crop faces out, since you can just target index 1 in an image, and use it for target image index 0.

Feature 1: Multi targeting Feature 2: source index , although by doing feature 1 feature 2 is done for free. Describe the idea you'd like

It would be great if we had some sort of parity to this so that we didn't have to do multiple operations. Also this would help not needing to do post processing to a source image if we can just target it in an index as well.

machineminded commented 6 months ago

Yes, definitely agree. The base inswapper library I am using should be able to support this out of the box, we just need to add the necessary fields on the UI and pass them down.

machineminded commented 6 months ago

@ujl123 I have a first cut of this working in another branch. It will require me to change how haofanwang's inswapper repo is cloned during configure.bat. But should have this wrapped up in the next day or two.

machineminded commented 5 months ago

I am adding some improvements to the inswapper by integrating some of the reactor code. I will add this in as well. Hopefully have this request wrapped up in the coming days.

ujl123 commented 3 months ago

@machineminded Just pulled the new version and I see that the faceswap is in a different window with all the features mentioned. However I don't see a clear way to use the faceswap for images that are outside of the Fooocus workflow. For example if I have an existing image that I simply want to faceswap, what is the correct way to do this? I'm not going to inpaint anything, upscale etc, Just a straight swap.

machineminded commented 3 months ago

@ujl123 Can you try loading your image into the Inswapper panel, then load your target image into the inpainting panel, and run it? If that doesn't work, try just inpainting the face and run it again. It's a bit of a workaround for now, but one of those should work. I can update it so that a mask isn't required.

ujl123 commented 3 months ago

@machineminded I tried using inpainting and masked, however it seemed to altered the entire image (not dramatically). I thought for inpainting only what is masked is edited? This caused me to think that this was the wrong way to do this AND/OR I misunderstood what inpainting was.

  1. Does inpainting strictly only edit what is masked?
  2. Did I use the wrong settings and caused the entire image to be edited?
  3. Weird roop/inpaint interaction?

image

machineminded commented 3 months ago

I'll look into this - but since I'm away from my personal PC, my guess is that the restore faces functionality is fixing every face in the image.