Selur's Little Message Board

Full Version: ProPainter Vapoursynth filter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Got a current mac mini, but I have no clue how to get torch working on macos Smile
So no clue
@Dan64: Can you look at the code what could cause problems when ProPainter is called twice in a single script?
Using this script:
Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Limit frame cache to 48449MB
core.max_cache_size = 48449
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
# Import scripts
import validate
# Source: 'C:\Users\Selur\Desktop\Test_Video_2.mp4'
# Current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: HEVC
# Loading 'C:\Users\Selur\Desktop\Test_Video_2.mp4' using DGSource
clip = core.dgdecodenv.DGSource("J:/tmp/mp4_ba4dcf39836d47afe99685c577b7f350_853323747.dgi") # 25 fps, scanorder: progressive
frame = clip.get_frame(0)
# setting color matrix to 709.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
# setting color transfer (vs.TRANSFER_BT709), if it is not set.
if validate.transferIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
# setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
if validate.primariesIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the detected scan type is set (detected: progressive)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
# changing range from limited to full range for vsProPainter
clip = core.resize.Bicubic(clip, format=vs.YUV420P8, 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 RGB24 for vsProPainter
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_in_s="full", range_s="full")
# Inpainting using ProPainter
from vspropainter import propainter as ProPainter
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.png", length=500, mask_region=(520,256,1400,0))
# changing range from full to limited range for vsProPainter
clip = core.resize.Bicubic(clip, format=vs.RGB24,range_in_s="full", range_s="limited")
# changing range from limited to full range for vsProPainter
clip = core.resize.Bicubic(clip, format=vs.RGB24, range_in_s="limited", range_s="full")
# Inpainting using ProPainter
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.png", length=500, mask_region=(256,256,0,0))
# changing range from full to limited range for vsProPainter
clip = core.resize.Bicubic(clip, format=vs.RGB24,range_in_s="full", range_s="limited")
# adjusting output color from RGB24 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_in_s="full", range_s="limited") # additional resize to match target color sampling
# set output frame rate to 25fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# output
clip.set_output()
# script was created by Hybrid 2025.12.29.1
with this video and mask
Either the left or right logo is removed properly and the other isn't.

Using:
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.png", length=500, mask_region=(520,256,1400,0))
followed by:
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.png", length=500, mask_region=(256,256,0,0))
only the right logo is removed properly.
Switching the order, only the left logo is properly removed.

---
I'll look at why Hybrid does this unnecessary conversion:
Code:
# changing range from full to limited range for vsProPainter
clip = core.resize.Bicubic(clip, format=vs.RGB24,range_in_s="full", range_s="limited")
# changing range from limited to full range for vsProPainter
clip = core.resize.Bicubic(clip, format=vs.RGB24, range_in_s="limited", range_s="full")
(I'm pretty sure I know how this happens,... I probably forgot to update the current TV scale value somewhere.)

Cu Selur

Ps.: going to bed now. Smile
Hello Selur,

   to speed-up the inference, ProPainter has been implemented as a Singleton Class.
   I attached a new version where ProPainter is implemented as a normal class, let me know if is working on your side and if you note a lower inference speed respect to the  previous version.

Best wishes for a happy new year 2026
Dan
Happy New Years to you too.
Will test later and report back.

Cu Selur
Seems to work fine here, using ProPainter multiple times in a script works. Smile

Cu elur
Hello Selur,

  I just released the new version v1.2.3 with the requested change.

Dan
Nice, I'll release an updated dev and torch add-on later.

Cu Selur

Ps.: is up now
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14