C0untFloyd / roop-unleashed

Evolved Fork of roop with Web Server and lots of additions
GNU Affero General Public License v3.0
2.33k stars 541 forks source link

Extras / enhancers the performance is terribly slow. #945

Open talbertj20 opened 1 month ago

talbertj20 commented 1 month ago

When using the extras / enhancers the performance is terribly slow. Previously when using ESRGAN X2 i would process at about 1-2 fps and now it is about 33 fps. I do not see a drop in face swapping, or at least nothing as noticeable. This has been occurring for the past several release. See screenshots below for errors.

Things i have tried so far and still get the same results. -Completely deleted old Roop-Unleashed Folder. -Completed removed all traces of NVidia Drivers -Ran Windows 11 Updates -Reinstalled NVidia CUDA 11.8 -Fresh install of Roop-Unleashed on my fastest local SSD Drive.

Other System Specs: AMD Ryzen 7 5800X3D 32GB RAM

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Extras'
  2. Add Image Files to Process
  3. Click on 'Enhancers'
  4. Scroll down to 'ESRGAN X2'
  5. Click on Start Processing
  6. See error in screenshot below

Details What OS are you using?

Are you using a GPU?

Which version of roop unleashed are you using? roop unleashed 4.3.2

Screenshots If applicable, add screenshots to help explain your problem. Screenshot 2024-10-04 092605 Screenshot 2024-10-04 103223

C0untFloyd commented 1 month ago

Thanks for the info, I can reproduce the warning in yellow but I'm actually unsure if this wasn't always present. Upscaling always was quite slow with my RTX 2060 Super so I'm not certain if it's slower or faster nowadays. What I'm sure about is that there has been no code change since upscaling was first implemented. There were however upgrades of the onnxruntime versions. Your powerful gpu taking so long for a frame isn't right. For testing I upscaled a 1920x1080 video with ESRGANx2 and it's taking ~8 secs on average for a frame:

Processed resolution: (3840, 2160) ['ffmpeg', '-hide_banner', '-hwaccel', 'auto', '-y', '-loglevel', 'error', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '3840x2160', '-pix_fmt', 'bgr24', '-r', '25.0', '-an', '-i', '-', '-vcodec', 'libx264', '-crf', '14', '-vf', 'colorspace=bt709:iall=bt601-6-625:fast=1', '-pix_fmt', 'yuv420p', 'E:\Coding\Projects\Python\roop-unleashed_main\output\tag_cut__temp.mp4'] Processing: 99%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 90/91 [14:38<00:09, 9.76s/frames, memory_usage=01.10GB, execution_threads=3]

Just an idea, you're writing that you installed new and I'm seeing that you're using 3 threads. Perhaps you used a higher number of frames back then? Because as you have quite a fast gpu the number of threads here could make a difference. I'm still investigating in this case, perhaps there is something but you could test if 6 threads make a difference for you. Also for a minor speedup you could change the image output format to jpg.

talbertj20 commented 1 month ago

I was already using jpg output. I did increase threads from 3 to 6 and restarted roop-unleashed and rana small test.

image

C0untFloyd commented 1 month ago

This is weird, especially that you have slower processing than me although using a much better gpu. I currently have no idea, perhaps you could install the onnxruntime versions from the last (for you) fast version?

Elise96nl commented 1 month ago

@C0untFloyd

i was having problems with the upscale on my AMD machine with DML.

512 was always the same as 128 in sharpness and quality. I dont think the esrgan x4 was working with dml.

i just downloaded the real_hatgan_x4.onnx, put it in the frame folder, and changed this in the code.

now i know what you guys like about the upscaling instead of post processing elif self.prev_type == "real_hatgan_x4": model_path = resolve_relative_path('../models/Frame/real_hatgan_x4.onnx') self.scale = 4

jackjack1234321 commented 3 weeks ago

이제 여러분이 포스트 프로세싱 대신 업스케일링을 좋아하는 이유를 알았습니다. elif self.prev_type == "real_hatgan_x4": model_path = resolve_relative_path('../models/Frame/real_hatgan_x4.onnx') self.scale = 4

Where should I change the code??? I also had a hard time using it because the speed was too slow, so I tested it with 128px and it was better. Can you tell me where to add the code???