Posts: 738
Threads: 70
Joined: Feb 2020
Hello Selur,
I'm using the Hybrid version Hybrid_dev_2023.01.02-154959.
I noted that when I'm using the realesr-general-x4v3 mode,l the parameter denoise_strength is not set in the generated script, so that will be always used the default value of 0.5. The parameter is correctly set only if I check the box: Vapoursynth->Misc-Script->Don't hide defaults.
Despite the comment of the author regarding this parameter: Denoise strength for realesr-general-x4v3 model. 0 for weak denoise (keep noise), 1 for strong denoise ability.
I don't have observed any difference in changing the value of denoise_strength on the output image
Dan
Posts: 10.553
Threads: 57
Joined: May 2017
07.01.2023, 01:33
(This post was last modified: 07.01.2023, 01:43 by Selur.)
That is strange since it seems to work here and I last update the torchAddon on 01.01.
Checked the source code RealESRGAN code wasn't changed on 2022-12-17.
# Imports
import vapoursynth as vs
import os
import ctypes
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("i:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
import sys
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'i:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
import site
# Adding torch dependencies to PATH
path = site.getsitepackages()[0]+'/torch_dependencies/'
ctypes.windll.kernel32.SetDllDirectoryW(path)
path = path.replace('\\', '/')
os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
# Import scripts
import havsfunc
# source: 'G:\TestClips&Co\files\MPEG-2\Fever.vob'
# current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
# Loading G:\TestClips&Co\files\MPEG-2\Fever.vob using DGSource
clip = core.dgdecodenv.DGSource("J:/tmp/vob_84e4925bd13c3477fb8d42a42a17b582_853323747.dgi",fieldop=0)# 25 fps, scanorder: top field first
# Setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=5)
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2)
# setting field order to what QTGMC should assume (top field first)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 50
# make sure content is preceived as frame based
clip = core.std.SetFieldBased(clip, 0)
# cropping the video to 696x568
clip = core.std.CropRel(clip=clip, left=12, right=12, top=4, bottom=4)
# adjusting color space from YUV420P8 to YUV444P16 for vsGLSLCAS
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
with open("i:/Hybrid/64bit/vsfilters/GLSL/parameterized/CAS.glsl") as glslf:
glsl = glslf.read()
glsl = glsl.replace('#define SHARPENING 0.0', '#define SHARPENING 0.8')
glsl = glsl.replace('#define CAS_BETTER_DIAGONALS 1', '#define CAS_BETTER_DIAGONALS 1')
glsl = glsl.replace('#define CAS_GO_SLOWER 0', '#define CAS_GO_SLOWER 1')
glsl = glsl.replace('#define SOURCE_TRC 0', '#define SOURCE_TRC 0')
glsl = glsl.replace('#define TARGET_TRC 0', '#define TARGET_TRC 0')
clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
# adjusting color space from YUV444P16 to RGBS for vsBasicVSRPPFilter
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# Quality enhancement using BasicVSR++
from vsbasicvsrpp import BasicVSRPP
clip = BasicVSRPP(clip=clip, model=4, interval=300, fp16=True)
from vsrealesrgan import RealESRGAN
# resizing using RealESRGAN
clip = RealESRGAN(clip=clip, model=5, device_index=0, trt=True, trt_cache_path=r"J:\tmp", denoise_strength=0.10) # 2784x2272
# resizing 2784x2272 to 1920x1470
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=1920, h=1470, kernel="spline64", interlaced=False, interlacedd=False)
# adjusting output color from: RGBS to YUV444P12 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P12, matrix_s="470bg", range_s="limited", dither_type="none")
# set output frame rate to 50fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
# Output
clip.set_output()
Are you using the FilterQueue?
I noticed a bug regarding the FilterQueue and the resizers, but I haven't had time to look into it. (maybe tomorrow)
Checked the FilterQueue bug, there RealCUGAN and RealESRGAN were accidentally swapped, but the denoise level worked fine.
=> try resetting your default values and if you use a saved profile, load check and resave it. RealESRGAN model=5 works fine here.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 10.553
Threads: 57
Joined: May 2017
You did try another value than the default (0.5)?
Since the default will be hidden since it's a default.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 738
Threads: 70
Joined: Feb 2020
Hello Selur,
I don't know what happened yesterday: I was just using a new instance of Hybrid while a the second one was running using DPIR.
But this morning the denoise strength was included in the script.
But it is still not working on the generated video.
I attached an archive with the script used and the output of filters DPIR and RealESRGAN with different value of denoise strength.
You will see that in DPIR the deoinse strength is working, while on RealESRGAN not (is something near to DPIR with deoine stregth between 5.0 and 8.0).
Dan
Posts: 10.553
Threads: 57
Joined: May 2017
07.01.2023, 12:26
(This post was last modified: 07.01.2023, 12:27 by Selur.)
Comparing 0.01 and 1.00 I clearly see a difference here: https://imgsli.com/MTQ1Njk3
The difference is not as high as one might have hoped: https://imgsli.com/MTQ1Njk4
But, even with your image (comparing 0.01 vs 0.99) there is a difference: https://imgsli.com/MTQ1Njk5
My guess is you are hoping for more difference in the strength than RealESRGAN offers.
You can ask HolyWu whether there is a way to increase the effect of denoising strength, but it does work.
=> this is not an issue of Hybrid, but maybe you are needing better glasses or ways to compare the output.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 738
Threads: 70
Joined: Feb 2020
Hello Selur,
as reference I included the denoise effect using DPIR and as you can see there is a "visible" difference changing the denoise strength.
I was hoping for a similar difference. Looking to your images it is strange that effect of denoise in RealESRGAN is more visible when there is no noise than when there is the real need to apply a denoise: on the images that I sent to you the effect is mush less "visible".
Thanks for the comparison, the tool that you used is very useful
Dan
Posts: 738
Threads: 70
Joined: Feb 2020
Hello Selur,
In the case could be useful I found a stand-alone version of Video/Image compare tool at the following link: https://github.com/pixop/video-compare
Dan
Posts: 10.553
Threads: 57
Joined: May 2017
I usually use Vapoursynth and compare stuff there, but maybe other users have need for that.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
|