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.

ProPainter Vapoursynth filter
#27
I released the new RC3 (attached)

If are not found bugs should be also the initial release.

This is the (final) header:

def propainter(
    clip: vs.VideoNode,
    length: int = 100,
    clip_mask: vs.VideoNode = None,
    img_mask_path: str = None,
    mask_dilation: int = 8,
    neighbor_length: int = 10,
    ref_stride: int = 10,
    raft_iter: int = 20,
    mask_region: tuple[int, int, int, int] = None,
    weights_dir: str = model_dir,
    enable_fp16: bool = True,
    device_index: int = 0,
    inference_mode: bool = False
) -> vs.VideoNode:
    """ProPainter: Improving Propagation and Transformer for Video Inpainting

    :param clip:            Clip to process. Only RGB24 format is supported.
    :param length:          Sequence length that the model processes (min. 12 frames). High values will
                            increase the inference speed but will increase also the memory usage. Default: 100
    :param clip_mask:       Clip mask, must be of the same size and lenght of input clip. Default: None
    :param img_mask_path:   Path of the mask image: Default: None
    :param mask_dilation:   Mask dilation for video and flow masking. Default: 8
    :param neighbor_length: Length of local neighboring frames. Low values decrease the
                            memory usage. Default: 10
    :param ref_stride:      Stride of global reference frames. High values will allow to
                            reduce the memory usage and increase the inference speed. Default: 10
    :param raft_iter:       Iterations for RAFT inference. Low values will decrease the inference
                            speed but could affect the output quality. Default: 20
    :param mask_region:     Allow to restirct the region of the mask, format: (width, height, left, top).
                            The region must be big enough to allow the inference. Available only if clip_mask
                            is specified. Default: None
    :param enable_fp16:     If True use fp16 (half precision) during inference. Default: fp16 (for RTX30 or above)
    :param device_index:    Device ordinal of the GPU (if = -1 CPU mode is enabled). Default: 0
    :param inference_mode:  Enable/Disable torch inference mode. Default: False
    """

  I added some interesting parameter.

1) clip_mask: now it is possible to pass a clip mask. You can test it using the provided sample and the following code:

# build clip mask
clip_mask = core.imwri.Read(["running_car_mask.png"])
clip_mask = core.std.Loop(clip=clip_mask, times=clip.num_frames)
clip_mask = core.std.AssumeFPS(clip=clip_mask, fpsnum=25, fpsden=1)
# remove mask using propainter
from vspropainter import propainter
clip = propainter(clip, length=96, clip_mask=clip_mask)

In my tests it seems that using a mask clip even if there is only one frame, improves the speed.

2) mask_region: it is possible to define a smaller area for apply the propainter mask. You can test it using the provided sample and the following code:

# build clip mask
clip_mask = core.imwri.Read(["running_car_mask.png"])
clip_mask = core.std.Loop(clip=clip_mask, times=clip.num_frames)
clip_mask = core.std.AssumeFPS(clip=clip_mask, fpsnum=25, fpsden=1)
# remove mask using propainter
from vspropainter import propainter
clip = propainter(clip, length=96, clip_mask=clip_mask, mask_region=(596-68*2, 336-28*2, 68, 28))

3) inference_mode: if true it will be enabled the "torch" inference mode. I don't have noted any speed increment/decrement by enabling it.

I was able to significantly speed up the inference using this code:

# build clip mask
clip_mask = core.imwri.Read(["running_car_mask.png"])
clip_mask = core.std.Loop(clip=clip_mask, times=clip.num_frames)
clip_mask = core.std.AssumeFPS(clip=clip_mask, fpsnum=25, fpsden=1)
# remove mask using propainter
from vspropainter import propainter
clip = propainter(clip, length=96, clip_mask=clip_mask, mask_region=(596-88*2, 336-38*2, 88, 38), ref_stride=25, raft_iter=15, inference_mode=True)
 
have fun!

Dan


Attached Files
.zip   vspropainter-1.0.0_RC3.zip (Size: 66,81 KB / Downloads: 27)
Reply


Messages In This Thread
ProPainter Vapoursynth filter - by Selur - 28.05.2024, 14:23
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 15:15
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 15:47
RE: ProPainter Vapoursynth filter - by Dan64 - 28.05.2024, 18:04
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 18:23
RE: ProPainter Vapoursynth filter - by Dan64 - 28.05.2024, 18:30
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 18:43
RE: ProPainter Vapoursynth filter - by Dan64 - 28.05.2024, 19:05
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 19:28
RE: ProPainter Vapoursynth filter - by Dan64 - 28.05.2024, 19:43
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 19:58
RE: ProPainter Vapoursynth filter - by Dan64 - 28.05.2024, 20:10
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 20:17
RE: ProPainter Vapoursynth filter - by Dan64 - 28.05.2024, 20:28
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 20:33
RE: ProPainter Vapoursynth filter - by Dan64 - 28.05.2024, 20:36
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 20:40
RE: ProPainter Vapoursynth filter - by Dan64 - 28.05.2024, 21:21
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 22:06
RE: ProPainter Vapoursynth filter - by Selur - 28.05.2024, 22:52
RE: ProPainter Vapoursynth filter - by Dan64 - 28.05.2024, 22:56
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 07:13
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 09:08
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 15:55
RE: ProPainter Vapoursynth filter - by Dan64 - 29.05.2024, 17:12
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 17:14
RE: ProPainter Vapoursynth filter - by Dan64 - 29.05.2024, 17:38
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 17:45
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 17:56
RE: ProPainter Vapoursynth filter - by Dan64 - 29.05.2024, 18:52
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 20:45
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 20:56
RE: ProPainter Vapoursynth filter - by Dan64 - 29.05.2024, 21:48
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 21:50
RE: ProPainter Vapoursynth filter - by Selur - 29.05.2024, 22:30
RE: ProPainter Vapoursynth filter - by Selur - 30.05.2024, 11:01
RE: ProPainter Vapoursynth filter - by Dan64 - 30.05.2024, 20:21
RE: ProPainter Vapoursynth filter - by Selur - 30.05.2024, 20:27
RE: ProPainter Vapoursynth filter - by Dan64 - 30.05.2024, 20:37
RE: ProPainter Vapoursynth filter - by Selur - 30.05.2024, 21:03
RE: ProPainter Vapoursynth filter - by Dan64 - 30.05.2024, 22:06
RE: ProPainter Vapoursynth filter - by Selur - 31.05.2024, 06:39
RE: ProPainter Vapoursynth filter - by Selur - 31.05.2024, 07:20
RE: ProPainter Vapoursynth filter - by Dan64 - 31.05.2024, 17:54
RE: ProPainter Vapoursynth filter - by Selur - 31.05.2024, 17:59
RE: ProPainter Vapoursynth filter - by Selur - 31.05.2024, 19:17
RE: ProPainter Vapoursynth filter - by Dan64 - 31.05.2024, 22:07
RE: ProPainter Vapoursynth filter - by Selur - 01.06.2024, 07:00
RE: ProPainter Vapoursynth filter - by Dan64 - 01.06.2024, 09:59
RE: ProPainter Vapoursynth filter - by Selur - 01.06.2024, 10:06
RE: ProPainter Vapoursynth filter - by Dan64 - 01.06.2024, 10:27
RE: ProPainter Vapoursynth filter - by Selur - 01.06.2024, 10:37
RE: ProPainter Vapoursynth filter - by Dan64 - 01.06.2024, 13:55
RE: ProPainter Vapoursynth filter - by Dan64 - 01.06.2024, 23:11
RE: ProPainter Vapoursynth filter - by Selur - 02.06.2024, 08:20
RE: ProPainter Vapoursynth filter - by Dan64 - 02.06.2024, 08:48
RE: ProPainter Vapoursynth filter - by Selur - 02.06.2024, 09:01
RE: ProPainter Vapoursynth filter - by Dan64 - 02.06.2024, 09:33
RE: ProPainter Vapoursynth filter - by Selur - 02.06.2024, 09:38
RE: ProPainter Vapoursynth filter - by Dan64 - 04.06.2024, 18:40
RE: ProPainter Vapoursynth filter - by Dan64 - 04.06.2024, 19:07
RE: ProPainter Vapoursynth filter - by Selur - 04.06.2024, 19:09
RE: ProPainter Vapoursynth filter - by Dan64 - 04.06.2024, 19:17
RE: ProPainter Vapoursynth filter - by Selur - 04.06.2024, 19:34
RE: ProPainter Vapoursynth filter - by Dan64 - 04.06.2024, 19:50
RE: ProPainter Vapoursynth filter - by Selur - 04.06.2024, 19:59
RE: ProPainter Vapoursynth filter - by Dan64 - 05.06.2024, 18:37
RE: ProPainter Vapoursynth filter - by Selur - 05.06.2024, 19:14
RE: ProPainter Vapoursynth filter - by Dan64 - 05.06.2024, 20:23
RE: ProPainter Vapoursynth filter - by Selur - 06.06.2024, 15:06
RE: ProPainter Vapoursynth filter - by Selur - 06.06.2024, 16:24
RE: ProPainter Vapoursynth filter - by Dan64 - 06.06.2024, 18:28
RE: ProPainter Vapoursynth filter - by Selur - 06.06.2024, 18:33
RE: ProPainter Vapoursynth filter - by Dan64 - 06.06.2024, 18:45
RE: ProPainter Vapoursynth filter - by Selur - 06.06.2024, 18:50
RE: ProPainter Vapoursynth filter - by safshe - 11.06.2024, 09:04
RE: ProPainter Vapoursynth filter - by Selur - 11.06.2024, 17:00
RE: ProPainter Vapoursynth filter - by Dan64 - 11.06.2024, 17:27
RE: ProPainter Vapoursynth filter - by Selur - 11.06.2024, 17:33
RE: ProPainter Vapoursynth filter - by Selur - 22.06.2024, 13:48
RE: ProPainter Vapoursynth filter - by Dan64 - 22.06.2024, 23:31
RE: ProPainter Vapoursynth filter - by Selur - 23.06.2024, 07:16
RE: ProPainter Vapoursynth filter - by Dan64 - 23.06.2024, 10:00
RE: ProPainter Vapoursynth filter - by Selur - 23.06.2024, 10:11
RE: ProPainter Vapoursynth filter - by Dan64 - 23.06.2024, 10:25
RE: ProPainter Vapoursynth filter - by Selur - 23.06.2024, 10:29
RE: ProPainter Vapoursynth filter - by Dan64 - 23.06.2024, 10:37
RE: ProPainter Vapoursynth filter - by Selur - 27.06.2024, 20:25
RE: ProPainter Vapoursynth filter - by Dan64 - 28.06.2024, 17:58
RE: ProPainter Vapoursynth filter - by Selur - 28.06.2024, 18:04
RE: ProPainter Vapoursynth filter - by Dan64 - 28.06.2024, 18:16
RE: ProPainter Vapoursynth filter - by Selur - 28.06.2024, 18:18
RE: ProPainter Vapoursynth filter - by Dan64 - 28.06.2024, 18:27
RE: ProPainter Vapoursynth filter - by Selur - 28.06.2024, 18:28
RE: ProPainter Vapoursynth filter - by Dan64 - 28.06.2024, 20:39
RE: ProPainter Vapoursynth filter - by Selur - 28.06.2024, 20:53
RE: ProPainter Vapoursynth filter - by Selur - 28.06.2024, 21:12
RE: ProPainter Vapoursynth filter - by Dan64 - 28.06.2024, 22:49
RE: ProPainter Vapoursynth filter - by Selur - 29.06.2024, 08:08
RE: ProPainter Vapoursynth filter - by Dan64 - 29.06.2024, 08:30
RE: ProPainter Vapoursynth filter - by Selur - 29.06.2024, 08:41
RE: ProPainter Vapoursynth filter - by Dan64 - 29.06.2024, 09:19
RE: ProPainter Vapoursynth filter - by Selur - 29.06.2024, 09:23
RE: ProPainter Vapoursynth filter - by Selur - 29.06.2024, 10:47
RE: ProPainter Vapoursynth filter - by Selur - 29.06.2024, 19:40
RE: ProPainter Vapoursynth filter - by Dan64 - 29.06.2024, 20:56
RE: ProPainter Vapoursynth filter - by Selur - 25.10.2024, 11:43
RE: ProPainter Vapoursynth filter - by Selur - 25.10.2024, 12:49
RE: ProPainter Vapoursynth filter - by Dan64 - 28.10.2024, 18:40
RE: ProPainter Vapoursynth filter - by Selur - 28.10.2024, 18:46
RE: ProPainter Vapoursynth filter - by Dan64 - 29.10.2024, 00:21
RE: ProPainter Vapoursynth filter - by Dan64 - 29.10.2024, 11:01

Forum Jump:


Users browsing this thread: 5 Guest(s)