AI换脸技巧,roop换脸插件的安装

玩AI繪畫用stable diffuision的小夥伴很多已經用上了大名頂頂的一鍵換臉工具roop了,可是還是有很多小夥伴卡在了安裝這個外掛程式的路上不能自拔,作為程式設計純小白的我也被困在原地整整2天,還好我各種查資料及在AI繪畫群諮詢各位大佬,終於也于剛才安裝成roop外掛程式了。

文章比較長,如果你還沒有成功安裝roop請耐心看完,也許對你有所幫助,如果我的方法解決了你的問題,請點贊轉發收藏一鍵三聯將是對我最大鼓勵!
Installing roop only requires three simple steps

1. On Windows, download and install visual studio.During the installation process, make sure to include the Python and C++ packages. What this sentence means is that after downloading the visual stidio software, you must check the python development item and use C++ desktop development. Click these two options, and you only need to check these two options to ignore the others!

Here I recommend that you learn the basics of Visual Studio to better understand why you should install this software. I believe this will be very helpful for our AI painting later on. I have always believed that summarizing practical experiences is the best way to learn, and there is no exception to this rule.

二、安裝insightface==0.73這個開源項目

先看它的定義?InsightFace是一個用於人臉識別和人臉分析的開源專案。它提供了一套基於深度學習的人臉識別演算法和工具,旨在識別和分析圖像或視頻中的人臉。

During installation, it is recommended to upgrade the installation package to the sd-webui-aki-v4.2 version of Qiuye Boss, and run the following command in the python file path:

Command 1: pip install insightface==0.7.3
Many people get stuck at this step. The following issues may occur, and I’ve listed them here for you to reference when correcting the command.
1. When you enter the above command, it is not an internal or external command, nor is it a program or batch file that can be run. This problem may be caused by improperly handling the environment variable. In this case, simply change the command to the following:

Command 2: python -m pip install insightface==0.7.3

The above command means installing a specific version (0.7.3) of the InsightFace package using Python's pip package manager.
By specifying the module name after python -m, you can ensure that the correct module associated with a particular Python interpreter is used in the command line. This is important for ensuring that commands are executed correctly when using multiple Python versions or virtual environments.

2. An error message is displayed after entering command 1 or 2. The following prompt means that you are trying to use an untrusted or unsafe host to access the Python package warehouse. In your case you used  http://douban.com  The PyPI repository (http://pypi.douban.com), but it is identified as an untrusted or unsafe host.

這個時候你只需要在命令2後面加一行指令變為:

命令3:python -m pip install insightface==0.7.3 –trusted-host http://pypi.douban.com
3. 安裝過程中缺少insightface運行的依賴環境及模組,一般可能會缺少,cython,easydict,,mtplotlib等如下圖所示,每個報錯不一樣,你看看報錯具體顯示缺少哪個模組。如下圖所示!

At this time, you can download each of the following commands separately:
python -m pip install Cython
4. 在這個過程還有人會報錯pip需要升級,或者需要清除pip緩存,你可以分別輸入命令5和命令6
命令5:python.exe -m pip install –upgrade pip
Command 6: python -m pip cache purge

This set of operations basically allows you to install the InsightFace 0.7.3 version. You can check whether the installation was successful and the installation location by entering command 7.

Instruction 7: python -m pip show insightface
If the installation is successful, it will display as shown in the image below. If so, congratulations, you have successfully installed the plugin!

Launch Advanced Roop

1. Enter the roop folder and enter the command in the input field: cmd

2. Then run python -m venv venv

3. 等待一會兒完成後,見到裡面已生成文件夾venv

4. 然后输入命令 : call venv\Scripts\activate.bat

roop common commands

只用CPU處理視頻: python run.py

使用GPU處理視頻: python run.py –execution-provider cuda

圖片保存jpg格式 python run.py –execution-provider cuda –temp-frame-format jpg

視頻高清化處理: python run.py –execution-provider cuda –temp-frame-format jpg –frame-processor face_swapper face_swapper

處理臉部跳閃(默認為0.8) : python run.py –execution-provider cuda –temp-frame-format jpg –frame-processor face_swapper face_swapper –similar-face-distance 1.5

指定幀識別人臉並替換: python run.py –execution-provide cuda –reference-face-position 3 –reference-frame-number 166 –similar-face-distance 1.5

Older graphics cards have memory and thread limitations

python run.py –execution-provider cuda –max-memory 8 –execution-threads 8

python run.py –execution-provider cuda –max-memory 6 –execution-threads 2

python run.py –execution-provider cuda –max-memory 8 –execution-threads 4

Other parameters

temp-frame-format jpg, png} image format for frame extraction

temp-frame-quality [0-100]-output-video-encoder

幀提取的圖像品質

{libx264,libx265,libvpx-vp9,h264 nvenc,hevc nvenc} output video encoding

-output-video-quality [O-100] Output video quality

-max-memory MAX MEMORY Maximum RAM amount (in GB) -execution-threads EXECUTION THREADS Number of execution threads

Click to view the test effect video

3、stable diffusion安裝roop

1. 這個有三種方法,第一種直接在網址安裝,輸入以下下載位址即可!

2. Run the git clone command in this extensions folder as shown in the following image. This will result in the image shown because I have already installed it successfully. If you have not installed it yet, you will not see any errors.

3. If neither of the first two methods works, it may be due to a network issue. Simply download the roop package, extract it, and place it in the extensions folder to successfully activate the plugin.

最後一步,在擴展插件裡點擊應用並重啟用戶介面!

Leave a Reply

3
AI Assistant
WhatsApp
Email
AI Assistant
WhatsApp
Email
AI Assistant
Important notice: AI responses may be slower than expected. AI provides information for reference only, and we are not responsible for its accuracy or completeness. AI responses do not represent the position of this company.

Welcome! I'm here to help you with any questions about .

01:03