This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[BUG] Resize Keeps Changing on its own when Starting a Batch Queue, Please fix this.
#51
Would need a short video sample (a few seconds long) to say anything useful.
You probably would need to use some sort of masking,... you could apply your strong denoiser to just a specific section,..
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#52
yea that seems like too much work ill se wat i can do with it
Reply
#53
(16.10.2024, 16:02)Selur Wrote: Would need a short video sample (a few seconds long) to say anything useful.
You probably would need to use some sort of masking,... you could apply your strong denoiser to just a specific section,..

Yeah even if temporal is being called in the script it is not working the jaggies are still there Sad . I guess imma just use VSGAN to apply temporal because i dunno even know anymore what it could be. I still belive that it never worked.

# Imports
import vapoursynth as vs
# getting Vapoursynth core
import site
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'I:/AI_Upscale/Tools/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
os.environ["CUDA_MODULE_LOADING"] = "LAZY"
# loading plugins
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vs-mlrt/vstrt.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/DenoiseFilter/FluxSmooth/libfluxsmooth.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/DerainbowFilter/SmoothUV/libsmoothuv.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/libmotionmask.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/ColorFilter/Retinex/Retinex.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/TCanny.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/libfillborders.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/libtemporalmedian.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")# vsQTGMC
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import hysteria
from importlib.machinery import SourceFileLoader
vsmlrt = SourceFileLoader('vsmlrt', 'I:/AI_Upscale/Tools/Hybrid/64bit/vs-mlrt/vsmlrt.py').load_module()
import RainbowSmooth
import vs_temporalfix
import lostfunc
import havsfunc
import validate
# Source: 'I:\AI_Upscale\.Upscale Projects\03. DVD To Deinterlace\16x9 NTCS\TV Series 01.mkv'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg, format: mpeg-2
# Loading I:\AI_Upscale\.Upscale Projects\03. DVD To Deinterlace\16x9 NTCS\TV Series 01.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="I:/AI_Upscale/.Upscale Projects/03. DVD To Deinterlace/16x9 NTCS/TV Series 01.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
# setting color transfer (vs.TRANSFER_BT601), if it is not set.
if validate.transferIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
# setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
if validate.primariesIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# making sure frame rate is set to 29.97fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# making sure the detected scan type is set (detected: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # tff
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Slower", TFF=True) # new fps: 29.97
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
clip = clip[::2] # selecting previously even frames
clip = lostfunc.DeSpot(o=clip)
# changing range from limited to full range for vsTemporalfix
clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
# setting color range to PC (full) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_FULL)
# stabilizing using Temporalfix
clip = vs_temporalfix.vs_temporalfix(clip=clip,exclude="[10 20]")
# changing range from full to limited range for vsTemporalfix
clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# rainbow removal using RainbowSmooth
clip = RainbowSmooth.RainbowSmooth(clip=clip)
# removing grain using STPresso
clip = havsfunc.STPresso(clp=clip)
# denoising using KNLMeansCL
clip = havsfunc.KNLMeansCL(clip=clip)
from vsmlrt import Backend
# changing range from limited to full range for vsSCUNetmlrt
clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
# setting color range to PC (full) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_FULL)
# adjusting color space from YUV420P8 to RGBH for vsSCUNetmlrt
clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="full")
# denosing using SCUNet (mlrt)
clip = vsmlrt.SCUNet(clip, model=3, overlap=16, backend=Backend.TRT(fp16=True,device_id=0,verbose=True,use_cuda_graph=False, num_streams=1,builder_optimization_level=3,engine_folder="I:/AI_Upscale/.Upscale Projects/Engines"))
# changing range from full to limited range for vsSCUNetmlrt
clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
# adjusting color space from RGBH to YUV444P16 for vsGLSLCAS
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited")
with open("I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/GLSL/parameterized/CAS.glsl") as glslf:
  glsl = glslf.read()
glsl = glsl.replace('#define SHARPENING 0.0', '#define SHARPENING 0')
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 0')
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)
with open("I:/AI_Upscale/Tools/Hybrid/64bit/vsfilters/GLSL/parameterized/adaptive-sharpen.glsl") as glslf:
  glsl = glslf.read()
glsl = glsl.replace('#define curve_height    1.0', '#define curve_height    1.0000')
glsl = glsl.replace('#define anime_mode      false', '#define anime_mode    true')
glsl = glsl.replace('#define overshoot_ctrl  false', '#define overshoot_ctrl  false')
glsl = glsl.replace('#define video_level_out false', '#define video_level_out false')
clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
# adjusting color space from YUV444P16 to YUV420P16 for vsHysteria
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P16, range_s="limited")
# Using Hysteria for line darkening
clip = hysteria.Hysteria(clip=clip)
# Using FastLineDarkenMOD for line darkening
clip = havsfunc.FastLineDarkenMOD(c=clip)
# changing range from limited to full range for vsVSMLRT
clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
# setting color range to PC (full) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_FULL)
# adjusting color space from YUV420P16 to RGBH for vsVSMLRT
clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="full")
# Step 1: current: 720x480, target: 788x480
# resizing using VSMLRT
clip = vsmlrt.inference([clip],network_path="I:/AI_Upscale/Tools/Hybrid/64bit/onnx_models/2x_Pooh_V4_Candidate_2_422k.onnx", backend=Backend.TRT(fp16=True,device_id=0,num_streams=1,verbose=True,use_cuda_graph=False,workspace=1073741824,builder_optimization_level=3,engine_folder="I:/AI_Upscale/.Upscale Projects/Engines"))
# resizing 1440x960 to 788x480
# adjusting resizing
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="full")
clip = core.fmtc.resample(clip=clip, w=788, h=480, kernel="spline64", interlaced=False, interlacedd=False)
# adjusting color space from RGBS to RGBH for vsVSMLRT
clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, range_s="full", dither_type="error_diffusion")
# Step 2: current: 788x480, target: 852x480
# resizing using VSMLRT
clip = vsmlrt.inference([clip],network_path="I:/AI_Upscale/Tools/Hybrid/64bit/onnx_models/2x_Pooh_V4_Candidate_2_422k.onnx", backend=Backend.TRT(fp16=True,device_id=0,num_streams=1,verbose=True,use_cuda_graph=False,workspace=1073741824,builder_optimization_level=3,engine_folder="I:/AI_Upscale/.Upscale Projects/Engines"))
# resizing 1576x960 to 852x480
# adjusting resizing
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="full")
clip = core.fmtc.resample(clip=clip, w=852, h=480, kernel="spline64", interlaced=False, interlacedd=False)
# changing range from full to limited range for vsVSMLRT
clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
# adjusting output color from: RGBS to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
# set output frame rate to 29.97fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# output
clip.set_output()
Reply
#54
Looking at your script: You might want to change the position at which Temporalfix is applied atm. it's applied after DeSpot. (you might want to move it below 'Resize')
And yes, it might be that Temporalfix does not apply to your problem, since it applies to temporal flickering issues, but a fixed line is no temporal issue.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#55
(17.10.2024, 05:17)Selur Wrote: Looking at your script: You might want to change the position at which Temporalfix is applied atm. it's applied after DeSpot. (you might want to move it below 'Resize')
And yes, it might be that Temporalfix does not apply to your problem, since it applies to temporal flickering issues, but a fixed line is no temporal issue.

Cu Selur

Move  Temporalfix after resize ? Should i try moving it after deinterlace ?
Reply
#56
It should be placed behind the filter that causes the problem, since it's meant to deal with problems caused by single-frame machine learning filters on anime/cartoon content (VSGAN(Filter), VSMLRT), I would place there. So behind the resizer seems correct to me.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#57
(18.10.2024, 03:57)Selur Wrote: It should be placed behind the filter that causes the problem, since it's meant to deal with problems caused by single-frame machine learning filters on anime/cartoon content (VSGAN(Filter), VSMLRT), I would place there. So behind the resizer seems correct to me.

Cu Selur

OK seems good now. Got an Bug to report, Found out the hard way lmao. If you have "Resizer" checked then check "Stepped Resize" then u decide not to use "Resizer" but don't uncheck "Stepped Resize" welp Stepped Resize will stay enabled in the script even tho it is now grayed out and signifies it was disabled.
Reply
#58
Will look at it
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#59
Regarding stepped resize unintentionally used: Uploaded a new dev version which should fix the problem.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#60
(19.10.2024, 09:54)Selur Wrote: Regarding stepped resize unintentionally used: Uploaded a new dev version which should fix the problem.

Cu Selur

Thanks ill just stay on Stable for now dont wanna fuk something up. Is there a way to change where the settings are stored btw ?
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)