rlaphoenix / VSGAN

PyTorch-based Super-Resolution and Restoration Image Processing Module for VapourSynth
https://vsgan.phoeniix.dev
MIT License
190 stars 13 forks source link

EGVSR model leaving a grid pattern? #18

Closed AIisCool closed 2 years ago

AIisCool commented 2 years ago

Sorry to bring up another apparent issue....

image

Had to scale it down to attach, but there's a grid-like pattern and overall the result looks quite odd.

I read over on doom9 that you said:

Please note though, that EGVSR does not auto-detect settings from the model file yet. So you should manually override any settings that needs it when you load the model for correct results.

and so I assume this result is due to not doing that and simply using:

from vsgan import EGVSR clip = EGVSR(clip, device="cuda").\ load(r"C:\VapourSynth\vsgan_models\EGVSR\EGVSR_iter420000.pth").\ apply().\ clip

isn't going to work. But I have no idea how to override it to get the correct results?

rlaphoenix commented 2 years ago

Network settings are not automatically detected from EGVSR model files at the moment. That model expects the settings: nb=10, degradation="BD" in load.

I obtained these settings by reading the testing template files in the repo they are from: https://github.com/Thmen/EGVSR/blob/master/experiments_BD/EGVSR/001/test.yml

AIisCool commented 2 years ago

Thanks, that took care of that grid stuff. Though oddly without the grid, I'm getting a crash if I go a few frames into the sequence. Seem to not be getting as great results from EGVSR as I had expected based on their examples, but that's not on you.

rlaphoenix commented 2 years ago

I'm getting a crash if I go a few frames into the sequence.

Try setting the max VapourSynth threads to 1 to make sure you aren't getting more than (interval+1) frames every frame.

Since you super-res not 1, but 1+n(interval) frames every frame, the VRAM requirements are quite high. On my system I barely get interval=3 or 5 to work and I have 11 GiB. Sadly, I don't know if there's some kind of memory leak or something as I don't really know what performance would be expected by other people's inference code.

Regardless, I try my absolute best to get as much performance with as little VRAM as possible. I've since done a few commits to try to help as much as I can, which will be out in the next version. It might not help, as simply VRAM requirements are quite high. But do try setting the max threads to 1 via core.num_threads = 1 as it will definitely help. It will automatically do this when you use EGVSR in the next version.

P.S., on the latest commit, through vs-pipe, with interval=3 on a 720x480 RGB24 input, I got 6.0 fps, which climbed from 4.5~ to 6 over about a minute. It might have even grown further than 6 fps but the video finished rendering just as it reached it.

rlaphoenix commented 2 years ago

v1.6.4 fixes a big memory leak. This will definitely help reduce your VRAM. It reduced mine from about 9.6 GiB to 2.6 GiB with interval=3. I can now go as far as interval=30 and reach 10.8 GiB/11 GiB.

rlaphoenix commented 2 years ago

Going to close this now as all questions seem to be addressed.