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 15 16
I was able to get this result with the attached script.

[Image: attachment.php?aid=3537]

Let me know if is working on your side.

Dan
Nice!!
Yes, I can reproduce the effect with your script.
But why doesn't it also work when I use:
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.png", length=50, mask_dilation=0, neighbor_length=4, mask_region=(1080,256,0,1300))
When I use your mask it works, but why does it not work with mine?
Your mask doesn't have the same resolution as the video, and it also doesn't even have the same display aspect ratio (340x600 vs 1080x1920)

Cu Selur
DOH, your source video also has a lower resolution, so the problem is probably related to vram consumption. Sad
Okay, using the low resolution mask on my full resolution source, even when not lowering dilation, neighbor length, and length:
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/Education_ProPainter_small/mask_small.jpg", mask_region=(1080,256,0,1300))
does work.
[Image: grafik.png]
=> this seems to be an issue with the mask handling
Does it make sense to add an option to vs-propainter to divide mask width&height by a factor X ?

Cu Selur
I debugged the source and it seems that sometimes (depending on the input mask) the call to the function:

Code:
scipy.ndimage.binary_dilation(mask_img, iterations=mask_dilates)

 provides a wrong dilated mask. Not clear why and the debugging of "scipy" function is outside my scope.

So in summary if you get wrong results try to set 
Code:
mask_dilation=0       # skip the call to scipy.ndimage.binary_dilation()
   
 and check if this solve the problem.

Dan

P.S.
If you provide as input a low resolution mask, the mask is resized to the frame dimension inside the filter. 
In my tests mask_dilation=0 fixed the issue, but I worked on a small size clip.
For sure there is a problem on mask handling, probably due to memory constrains and using a mask region is the optimal way to manage it because the inference is performed only on the clip having the size of mask region.
using:
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.png", length=12, mask_dilation=0, mask_region=(1080,256,0,1300))
It's still broken:
[Image: grafik.png]
same with:
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.png", length=12, mask_dilation=0, neighbor_length=4, mask_region=(1080,256,0,1300))
[Image: grafik.png]
so it's not just fault of the dilation.
using:
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.png", length=12, mask_dilation=0, neighbor_length=4)
[Image: grafik.png]
Converting the PNG to jpg (4:2:0):
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.jpg", length=12, mask_dilation=0, neighbor_length=4, mask_region=(1080,256,0,1300))
[Image: grafik.png]
Converting the PNG to jpg (4:4:4 max quality):
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask.jpg", length=12, mask_dilation=0, neighbor_length=4, mask_region=(1080,256,0,1300))
[Image: grafik.png]
so doesn't seem to be a jpg vs png problem.

Cu Selur

Ps.: going to bed now, but I can do more testing, tomorrow
In the script "propainter_render.py", there is this code

Code:
def model_init(self, torch_device, model_dir: str = None, mpath: str = None):
        self.device = torch_device

        self.img_mask_is_cropped = False

        # load image mask if available
        if mpath is None:
            self.img_mask = None
        else:
            img_m = Image.open(mpath).convert('RGB')
            out_size = img_m.size
            if out_size == self.clip_size:
                self.img_mask = img_m
            else:
                self.img_mask = img_m.resize(self.clip_size)
        self.img_mask_orig = self.img_mask

So if you provide in input mask_small.jpg is resized as the image attached.

So looking to the code there is not difference in providing in input "mask_small.jpg" or "mask_big.png".

In effect using "mask_small.jpg" or "mask_big.png" it works while using "mask.png" it doesn't work, it is very crazy.
The only explanation that I can find is that the mask's edges in "mask.png" are sharper than in "mask_big.png", probably for a proper identification of mask edges it is better to use smooth edges.

Dan
Trying:
Code:
clip = ProPainter(clip, img_mask_path="C:/Users/Selur/Desktop/mask_big.png", length=50, mask_region=(1000,256,0,1300))
It works:
[Image: grafik.png]
so maybe adding an optional 'blur' option to vs-propainter might be a good idea.

Thanks!

Cu Selur
The true problem is that the format of your mask has #bits=1

[Image: attachment.php?aid=3539]

This format is not properly managed by ProPainter (It fails to recognize the mask)

While the format used by mask_big.png is the correct one

[Image: attachment.php?aid=3540]

In any case I decided to ad another option in ProPainter called mask_enhance, that if is enabled (default) will improve the Mask's hedges to allow better Mask recognition.

I attached the RC1 of new ProPainter v1.2.4.

Let me know if it works on your side.

Dan
Thanks.
Didn't think the png format could be an issue. Tongue
New version works fine here. With 'Enhance' enabled my inital png works fine.
Tested the RC and uploaded a new Hybrid_havc_test file which adds controls mask_enhance.

Cu Selur
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16