hacksider / Deep-Live-Cam

real time face swap and one-click video deepfake with only a single image
GNU Affero General Public License v3.0
36.26k stars 5.14k forks source link

How to improve processing speed of "Live" mode #279

Open FMsunyh opened 1 month ago

FMsunyh commented 1 month ago

Hello, I would like to ask, where can I start to improve the processing speed? Based on the test result of "Live" mode , it cannot achieve real-time performance, and I want to improve the speed.

CPU : i7-13700 GPU: 4090D Memory: 48G

cvaisnor commented 1 month ago

Are you running the main script with cuda enabled? On my AMD Ryzen 9 7950x I get about 3 FPS using all the cores, and when I run it with Docker through my 4090 it is definitely close to 30FPS.

FMsunyh commented 1 month ago

Are you running the main script with cuda enabled? On my AMD Ryzen 9 7950x I get about 3 FPS using all the cores, and when I run it with Docker through my 4090 it is definitely close to 30FPS.

What is the frame size of the video stream? I am Setting it to 640x360 can reach 25fps, but it will get stuck if it is larger(such as 960x540). I need clearer picture quality.

FMsunyh commented 1 month ago

Are you running the main script with cuda enabled? On my AMD Ryzen 9 7950x I get about 3 FPS using all the cores, and when I run it with Docker through my 4090 it is definitely close to 30FPS.

Also, by pulling the stream through rtmp, it can currently achieve 1280x720p, without face enhancement, do you have a good solution to speed up face enhancement?

cvaisnor commented 1 month ago

I am running the stream in the default resolution. Using 'face enhancement' with cuda enabled did bring the frames down quite a bit. It runs at around 10FPS now. I'm not sure how to speed up that configuration.

maxfrans commented 1 month ago

Up, which gpu'll work best for this? considering a laptop or pc to buy within 2-3k

FMsunyh commented 1 month ago

Up, which gpu'll work best for this? considering a laptop or pc to buy within 2-3k

CPU : i7-13700 GPU: 4090D Memory: 48G

I modified the code and added multi-threaded processing. 1280x720p can be done in real time. The problem now is that I can't turn on enhanced processing. @maxfrans