Free AI face-changing software FaceFusion nanny-level tutorial

In the making of customDigital HumanSometimes, in order to avoid infringement, face-changing software is used to replace the face shape of the original material. Today a customer made such a request, so here I use the software FaceFusuion to operate.

FaceFusion It was independently released by the core developers of the Roop project. It is officially described as the next generation of face swapping and enhancement software. This software can be used to process pictures and videos and can run on GPUs and CPUs.

In general, the interface feels quite simple to use. If your requirements are not high, you basically don’t need to change any configurations. Just select the source and target directly.

Free AI face-changing software FaceFusion nanny-level tutorial

Official website: https://github.com/facefusion/facefusion

To run this software, you can install it locally, use Colab, or rent cloud computing power. The software itself does not have very high requirements, but for a better experience, it would definitely be better to have a GPU and larger memory.

I started using Colab, but after all, it has free computing power, so either the GPU was not enough, or errors occurred while running. I don’t know if it was because my source file was a bit large. It was 400M at first, but I edited it later and reduced it to 200M.

But the same error was still reported. The background task ran to 100% and started again, but the video could not be synthesized. After struggling for most of the day, I gave up.

If you are interested, you can play it. The address is:

https://github.com/facefusion/facefusion-colab
After opening this address, open colab and execute each cell code. Whether it can be used depends on whether there is computing power.

Free AI face-changing software FaceFusion nanny-level tutorial

Since the free ones don’t work, I can only pay for it. The computing power platform I use here is AutoDL, which can be charged by volume and duration, and can also be charged by day, week, month, etc. It is quite flexible.

The official website address is: https://www.autodl.com/

After opening the address, if you have an account, log in directly. If you don’t have an account, just register an account yourself. It’s very simple.

Free AI face-changing software FaceFusion nanny-level tutorial

Because you will need to rent computing power later, you can recharge your account in advance. It is up to you how much you recharge, as long as it is enough to cover the cost of renting the machine later. Of course, you can also recharge later. It’s up to you.

Free AI face-changing software FaceFusion nanny-level tutorial

Just select or enter the recharge amount according to the interface prompts. WeChat and Alipay are supported.

Free AI face-changing software FaceFusion nanny-level tutorial

To rent computing power, we click on the "Computing Power Market" in the menu, where we can choose the billing method, region, GPU model, etc.

Free AI face-changing software FaceFusion nanny-level tutorial

Then just find a price that you can accept from below. "Wuhu District", "Foshan District" and "Inner Mongolia District A" are relatively cheaper.

Free AI face-changing software FaceFusion nanny-level tutorial

If the machine is available for rent, it will display several cards available for rent, such as "1 card available for rent". If it displays "Rented out", you have to wait a moment and refresh it more often, and other cards will be released. Unless it is peak time, it is still easy to rent. Otherwise, there may be no cards available for rent for half a day, and you can only wait.

When renting, consider your own requirements, such as "video memory", "internal memory", the size of the data disk, whether it can be expanded, etc., as well as the supported CUDA version. Some software will have requirements for this, so just pay attention to it.

For example, I rented one like this. I can use it according to my needs without any restrictions.

Free AI face-changing software FaceFusion nanny-level tutorial

Click the button that says you can rent a few cards to create an instance. Here you need to select an image. You can choose "basic image", "community image", etc.

The basic image contains only basic software. You can install the software you need later.

Community images are images that are made by others. After the machine is created, it can be used directly.

Because I didn't find FaceFusion in the community, I chose the basic one here and only installed Miniconda

Free AI face-changing software FaceFusion nanny-level tutorial

If the creation is not successful here and it prompts that there is no machine available, you need to wait a while. If the creation is successful, it will be turned on directly. You can see it in the "Container Instance" of the console, and then find "JupyterLab" under "Quick Tools" and click it to enter the machine instance.

Free AI face-changing software FaceFusion nanny-level tutorial

Enter the machine instance and you can perform operations here.

Free AI face-changing software FaceFusion nanny-level tutorial

Before the operation, you need to add a configuration so that you cannot access GitHub and other sites

Enter the command in the terminal

source /etc/network_turbo

Reference: https://www.autodl.com/docs/network_turbo/

Free AI face-changing software FaceFusion nanny-level tutorial

Install

Because the base image has conda, use it directly.

git clone https://github.com/facefusion/facefusion
conda create -n facefusion2 python=3.11 -y
source /root/miniconda3/bin/activate
conda activate facefusion2
python install.py --skip-venv

 

Free AI face-changing software FaceFusion nanny-level tutorial

Select "cuda" to install

Then install ffmpg

conda install ffmpeg -y
ffmpeg -version

 

Before starting, you can download the model in advance or not. It’s up to you. I didn’t download it because I felt the execution speed was okay.

wget https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128.onnxwget https://github.com/facefusion/facefusion-assets/releases/download/models/arcface_w600k_r50.onnxwget https://github.com/facefusion/facefusion-assets/releases/download/models/gfpgan_1.4.onnx

 

 

run

Run run.py directly in the project directory. If you have not downloaded the model in advance, you may need to wait and see the following access address.

Python run.py --execution-providers cuda --face-swapper-model inswapper_128

 

Free AI face-changing software FaceFusion nanny-level tutorial

Here is a little trick. If your target video is very large, you can upload it to a certain folder through AutoDL first, instead of uploading it through the interface. One advantage is that if there is an error in the face-changing process, you do not need to upload it again. You only need to specify the path when running it.

for example

python run.py --execution-providers cuda --face-swapper-model inswapper_128 --source=/tmp/gradio/2c830d29e00280596e3ab670ff6569a32c2ab9de/WechatIMG33.jpg --target=/tmp/gradio/717e7b728adac28ee0b336c8d2c3e90ea92c5f2b/v1.mp4 --output=/tmp/bbbb.mp4

 

Then you can directly read the uploaded file.

After running, there is an access address, 127.0.0.1:7860. This address can only be accessed internally. Originally, you can create an external address by changing a file, but it didn't work after I changed it.

So if you want to access it, there are two ways:

A local

Because AutoDL starts with an address like http://127.0.0.1:7860, which can only be accessed from internal machines, and I have

In "facefusion/uis/layouts/default.py", add share = True in ui.launch(show_api =False,share=True), but it still cannot create an external network address and will report an error.

So use the following local method

Free AI face-changing software FaceFusion nanny-level tutorial

Enter the following command in your local computer terminal

ssh -CNg -L 7860:127.0.0.1:7860 root@region-9.autodl.pro -p 26370

 

After entering this command, there will be a password. Just enter the one displayed on the interface.

Then enter http://localhost:7860/ in your local browser to access it.

2. External Network

Free AI face-changing software FaceFusion nanny-level tutorial

Operate in AutoDL machine

1 Download the file https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64
2 Rename frpc_linux_amd64_v0.2
3 Move to /root/miniconda3/envs/facefusion2/lib/python3.11/site-packages/gradio

 

But I used this method to download the file and moved it to that directory, but still got the same error.

"Could not create share link. Please check your internet connection or our status page: https://status.gradio.app."

There is no other way, so I just use the local SSH method.

Finally, when we open the address http://localhost:7860/, we see the following interface

Free AI face-changing software FaceFusion nanny-level tutorial

There was also a small episode here. After I selected the source and target, I clicked "start" and reported the following error: "INVALID_PROTOBUF: Load model from /root/autodl-tmp/facefusion/.assets/models/arcface_w600k_r50.onnx failed:Protobuf parsing failed."

Free AI face-changing software FaceFusion nanny-level tutorial

I tried it for a long time but couldn't fix it. I reinstalled the machine but it didn't work. Then I deleted the arcface_w600k_r50.onnx file and downloaded it again. Then there was no error.

The file address can be found under the project: https://github.com/facefusion/facefusion-assets.

Free AI face-changing software FaceFusion nanny-level tutorial

After selecting, you can see the task status of the background

Free AI face-changing software FaceFusion nanny-level tutorial

When "OUTPUT" sees the generated face-changing video, it means it is successful and you can preview it or download it.
statement:The content is collected from various media platforms such as public websites. If the included content infringes on your rights, please contact us by email and we will deal with it as soon as possible.
TutorialEncyclopedia

AI face-changing is so simple, Stable Diffusion Roop plugin usage tutorial

2024-2-15 9:25:57

Encyclopedia

From Taylor Swift's AI nude photos to a lifelike video face-changing tool, it's completely free, no installation required, and can be used online!

2024-2-17 9:10:45

Search