29.10.2024, 09:18
(29.10.2024, 04:46)Selur Wrote:[*][*]Since you told Hybrid the output should be '3408x1920', but the operations you used result in 6832x3840, Hybrid resizes to '3408x1920'.clip = core.std.Crop(clip=clip, left=8, right=8, top=0, bottom=0) # removing borders (vsVSMLRT) - 6832x3840
This makes no sense. the operations do not result in 6832x3840. i dunno why this has to be so complicated. 2 models are used that have times two resolution, that is way beyond what the result should be. You would technically be upscaling a 4k video to 8k+ then resizing it this makes no sense to me. It should be x4 the normal video resolution. I am not much knowledgeable about the mod8 stuff you mentioned but so far not a single upscaler has done this either.Here is the script i have been using the past years if that helps at all to make it more clear. As for the bug i will record video of it when im back from work. The below script results in x4 resolution of the video with no modifications to it nor any 8k upscales. Nowhere is defined what the target resolution is, the model decide it self. I just wanted to do the same thing but in Hybrid, buts its turning out not as straightforward as i thought, maybe the below script does shit i am unaware again i aint much knknowledgeable on this stuff and i was wrong.
import sys
import vapoursynth as vs
from src.rife_trt import rife_trt
from src.scene_detect import scene_detect
from src.utils import FastLineDarkenMOD
from vs_temporalfix import vs_temporalfix
sys.path.append("/workspace/tensorrt/")
core = vs.core
core.num_threads = 4
core.std.LoadPlugin(path="/usr/local/lib/libvstrt.so")
core.std.LoadPlugin(path="/usr/local/lib/x86_64-linux-gnu/libmvtools.so")
core.std.LoadPlugin(path="/usr/local/lib/x86_64-linux-gnu/libfillborders.so")
core.std.LoadPlugin(path="/usr/local/lib/x86_64-linux-gnu/libmotionmask.so")
core.std.LoadPlugin(path="/usr/local/lib/x86_64-linux-gnu/libtemporalmedian.so")
def metrics_func(clip):
offs1 = core.std.BlankClip(clip, length=1) + clip[:-1]
offs1 = core.std.CopyFrameProps(offs1, clip)
return core.vmaf.Metric(clip, offs1, 2)
def inference_clip(video_path="", clip=None):
interp_scale = 2
if clip is None:
clip = core.bs.VideoSource(source=video_path)
clip = FastLineDarkenMOD(clip)
clip = vs_temporalfix(clip, strength=400, tr=6, exclude="[10 20]", debug=False)
clip = vs.core.resize.Bicubic(clip, format=vs.RGBH, matrix_in_s="709")
clip = core.akarin.Expr(clip, "x 0 1 clamp")
upscaled = core.trt.Model(
clip,
engine_path="/workspace/tensorrt/Engines/2x_Ani4Kv2_G6i2_Compact_107500_FP16_852x480p.engine", #Anime4Kv2 x2 852x480p 16x9 NTCS
#tilesize=[854, 480],
overlap=[0, 0],
num_streams=1,
)
upscaled = core.trt.Model(
upscaled,
engine_path="/workspace/tensorrt/Engines/CuGAN_Pro_DeNoise3x_up2x_Opset13_FP16_Clamp_Colorfix_1704x960p.engine", #CuGAN Denoise x2 1704x960p 16x9 NTCS
#tilesize=[854, 480],
overlap=[0, 0],
num_streams=1,
)
upscaled_metrics = vs.core.resize.Bicubic(
clip, width=224, height=224, format=vs.YUV420P10, matrix_s="709"
)
upscaled_metrics = metrics_func(upscaled_metrics)
clip = core.akarin.Select(
[upscaled, upscaled[1:] + upscaled[-1]],
upscaled_metrics,
"x.float_ssim 0.999 >",
)
clip = vs.core.resize.Bicubic(clip, format=vs.YUV420P10, matrix_s="709")
return clip