xinntao / Real-ESRGAN

Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration.
BSD 3-Clause "New" or "Revised" License
27.64k stars 3.47k forks source link

ESRGAN massive CPU bottleneck #419

Closed TechnoMasterBoy closed 2 years ago

TechnoMasterBoy commented 2 years ago

Like I mentioned in this discussion: https://github.com/xinntao/Real-ESRGAN/discussions/269 ESRGAN is severely bottlenecked by my beastly CPU even though my GPU is trash. Ryzen 9 5900x: unknown GTX 1080: unknown My GPU is load is currently at 19% average while CPU is around 90-95%. It's literally telling me it's IDLING: unknown This is using the portable NCNN version with realesr-animevideov3 model at 4x, going from 628x480 to 2512x1920.

kiam001 commented 2 years ago

hmm no issues with a rtx 2060

kiam001 commented 2 years ago

image

TechnoMasterBoy commented 2 years ago

hmm no issues with a rtx 2060

Might be because RTX 2060 is supposedly weaker than GTX 1080 though, which might explain why your GPU has high usage. But I also have no idea what model you used and at what scale. I assume 4x scale since you posted that in the other issue. But without knowing the resolution, that means very little.

lextra2 commented 2 years ago

GPU: AMD Radeon RX 5700 CPU: AMD Ryzen 3900X OS: Windows 10

Works for me.

I get about 8% CPU usage and ~95% GPU (Compute 0) usage with realesrgan-ncnn-vulkan.exe v0.2.5.0 realesr-animevideov3-x2 1280x720 > 2560x1440 with PNG as input & output.

TechnoMasterBoy commented 2 years ago

GPU: AMD Radeon RX 5700 CPU: AMD Ryzen 3900X OS: Windows 10

Works for me.

I get about 8% CPU usage and ~95% GPU (Compute 0) usage with realesrgan-ncnn-vulkan.exe v0.2.5.0 realesr-animevideov3-x2 1280x720 > 2560x1440 with PNG as input & output.

Wow okay, I found the issue. The batch command I use is this: for %%a in ("*.png") do C:\ESRGAN\realesrgan-ncnn-vulkan.exe -i "%%a" -o "Output\%%~na.png" -n realesr-animevideov3 -s 2 And for some reason, that makes it take insanely long compared to just telling it to input one folder and output to another. Telling it to use a folder instead of that command makes my GPU run at full load according to GPU-Z. Even if taskmanager shows only like 20% 3D. Compute 0 has always shown me 0% Thanks guys for in a way making me experiment a bit to find out the issue.

lextra2 commented 2 years ago

GPU: AMD Radeon RX 5700 CPU: AMD Ryzen 3900X OS: Windows 10 Works for me. I get about 8% CPU usage and ~95% GPU (Compute 0) usage with realesrgan-ncnn-vulkan.exe v0.2.5.0 realesr-animevideov3-x2 1280x720 > 2560x1440 with PNG as input & output.

Wow okay, I found the issue. The batch command I use is this: for %%a in ("*.png") do C:\ESRGAN\realesrgan-ncnn-vulkan.exe -i "%%a" -o "Output%%~na.png" -n realesr-animevideov3 -s 2 And for some reason, that makes it take insanely long compared to just telling it to input one folder and output to another. Telling it to use a folder instead of that command makes my GPU run at full load according to GPU-Z. Even if taskmanager shows only like 20% 3D. Compute 0 has always shown me 0% Thanks guys for in a way making me experiment a bit to find out the issue.

I'm glad you fixed it. For future references, here are my exact steps:

  1. Create 2 folders named input & output

image

  1. Use this command to create input frames: ffmpeg -i input.mkv input/frame%08d.png
  2. Use this command to start esrgan: realesrgan-ncnn-vulkan -i input -o output -s 2
  3. Use this command to make a video: ffmpeg -i output/frame%08d.png -c:v libx264 -crf 10 -r 24000/1001 -pix_fmt yuv420p output.mkv