Why do I need an Alignments FIle for convert?

Getting errors or found a bug when converting faces from a trained model? Post about them here


Forum rules

Read the FAQs and search the forum before posting a new topic.

This forum is for reporting errors with the Convert process. If you want to get tips, or better understand the Convert process, then you should look in the Convert Discussion forum.

Please mark any answers that fixed your problems so others can find the solutions.

Locked
User avatar
Errol_Flynn
Posts: 10
Joined: Sat Jul 23, 2022 11:32 am

Why do I need an Alignments FIle for convert?

Post by Errol_Flynn »

Sorry, I appreciate your patience so far but I also have another question regarding converting:

Why do I need an alignments file when I'm just trying to swap pictures when converting? The pictures do not come from a video

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Clarification on removing Conda and Cuda to fix GPU

Post by torzdf »

Errol_Flynn wrote: Sun Jul 24, 2022 1:43 pm

For a price, would you consider training my model if I sent the faces to you? I noticed you have a patreon so is this something we could discuss in the discord and that you would be down for?

No, that's not what I do, I'm afraid. I'm a developer rather than a creator. You can ask in our Discord server, but I wouldn't hold your breath.

Errol_Flynn wrote: Sun Jul 24, 2022 3:37 pm

Why do I need an alignments file when I'm just trying to swap pictures when converting? The pictures do not come from a video

Check the convert guide. It covers this and more.

FWIW Training on CPU really isn't a recommended endeavour. Especially if this is your first swap. Everyone's first swap is bad.

My word is final

User avatar
Errol_Flynn
Posts: 10
Joined: Sat Jul 23, 2022 11:32 am

Re: Clarification on removing Conda and Cuda to fix GPU

Post by Errol_Flynn »

I see, thanks.

Regarding swapping images, I already read the convert guide twice but I still don't get how the alignments file relates to the images. I am only trying to swap independent images and they are not frames of a video so I do not have an alignments file for them - does this mean I should enable on-the-fly conversion for images?

Last edited by Errol_Flynn on Mon Jul 25, 2022 5:22 pm, edited 1 time in total.
User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Clarification on removing Conda and Cuda to fix GPU

Post by torzdf »

The purpose of the alignments file here is to tell Faceswap which is the target face that we should be swapping and where it exists within the frame

My word is final

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Clarification on removing Conda and Cuda to fix GPU

Post by torzdf »

  • On The Fly - Never use this option. Always generate an alignments file for your convert. However, if for some reason you don't want to do that, and you want to get a terrible swap that converts slowly, then by all means enable this option.

My word is final

User avatar
Errol_Flynn
Posts: 10
Joined: Sat Jul 23, 2022 11:32 am

Re: Clarification on removing Conda and Cuda to fix GPU

Post by Errol_Flynn »

The purpose of the alignments file here is to tell Faceswap which is the target face that we should be swapping and where it exists within the frame

But there is no alignments file for the independent images that I'm swapping, this is where I am getting confused.

Are you saying I should extract a random video of A and then use that alignments file to convert images?

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Clarification on removing Conda and Cuda to fix GPU

Post by torzdf »

So you need to generate one. The guides, literally, talks you through what an alignments file is, and why it is required. I don't know how I can make it any clearer than what is in the documentation. All I'm doing here is copying and pasting information that you can freely find yourself on this site. It says in various parts of the documentation that the process can be done on a video file or on a folder of images. However writing "your video file or folder of images" at every given point where they are referenced would be unwieldy. If you see "video" and have a "folder of images" then the process is the same.

From the convert guide:
If you have not already created an alignments file for your source video and cleaned it up, then you should do so now.

I would hope that it is painfully obvious that a video is just a series of images. If it is not, then now you know. Regardless if it's a video or a folder of images, they all distil down to one thing. You need an alignments file for all the images that you plan to convert on.

From the Extract guide:
Extracting serves 2 main purposes:
...

  • Converting: To generate an alignments file and mask for converting your final frames. The alignment file contains information about where each face is in each frame so that the conversion process knows where to swap faces for any given frame. When generating an alignments file for converting, then the extracted faces are not actually required, but they are useful for cleaning the alignments file (more on this later).

Ultimately, Faceswapping is a complex and involved task. You won't get it right first time, and everyone's first swap is terrible. The guides are written to help demystify the process as much as possible. They took me a long time to write. A very, very long time. Far longer than it would take anyone to read them. They are basically the holy grail to how to use the software.

I have no issue with clarifying parts or talking about techniques. I get frustrated when I need to talk through information that is easily available and already covered.

My word is final

User avatar
Errol_Flynn
Posts: 10
Joined: Sat Jul 23, 2022 11:32 am

Re: Clarification on removing Conda and Cuda to fix GPU

Post by Errol_Flynn »

I completely understand your frustration and I am very appreciative that you took the time to answer my questions.

The problem was an error on my part - I thought that alignments files were not generated when extracting images because I got my folders mixed up and couldn't find that alignments file for the images I extracted. I thought that only videos had alignments files.

That is why I was confused for needing an alignments file for images!

Again, thanks for your help

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Why do I need an Alignments FIle for convert?

Post by torzdf »

No problem.

Like I say, the process IS complicated. You WILL make mistakes and your first swap WILL be terrible. This is just how it goes.

Most of the issues you hit will come about because of some oversight or other, so if in doubt, just retrace your steps to see where you may have gone wrong.

My word is final

User avatar
Errol_Flynn
Posts: 10
Joined: Sat Jul 23, 2022 11:32 am

Re: Why do I need an Alignments FIle for convert?

Post by Errol_Flynn »

Gotcha. I do want to get better equipment in the future to try my hand at this a little bit better, I think it's a great piece of technology.

If you would allow me another question: is there any model that you think would be better just for swapping images? Always B onto A

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Why do I need an Alignments FIle for convert?

Post by torzdf »

No, the process is the same for both images and videos. As stated before, a video is just a series of images after all. Ultimately you still require a LOT of data for each side to get a convincing swap.

There are morph models out there (such as First Order Motion) which may work better for your use case. I believe Avatarify offers a relatively straightforward entry point to it.

My word is final

User avatar
damingxing
Posts: 23
Joined: Mon Jun 13, 2022 8:55 pm
Has thanked: 6 times

Re: Why do I need an Alignments FIle for convert?

Post by damingxing »

A follow-up question on the alignment file: if the alignment file is presented AND "on the fly" is also toggled on, is it going to use the alignment file or "on the fly" mode?

Much Thanks.

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Why do I need an Alignments FIle for convert?

Post by torzdf »

No idea. Probably use the on-the-fly mode, seeing as it was explicitly selected. I don't know because I never use On-The-Fly. The reason being that it is bad. Very bad.

My word is final

Locked