PeterL1n / RobustVideoMatting

Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!
https://peterl1n.github.io/RobustVideoMatting/
GNU General Public License v3.0
8.61k stars 1.14k forks source link

why predict foreground and alpha together, not alpha only? #42

Closed Stick-To closed 3 years ago

Stick-To commented 3 years ago

I think src * alpha = foreground

PeterL1n commented 3 years ago

No, it's not.

src = pha * fgr + (1 - pha) * bgr

The foreground will be exactly the same as src only for pixels where alpha is 1. But for semi-transparent regions, you need to predict the actual foreground.

Stick-To commented 3 years ago

got it, thanks

zhanghongyong123456 commented 2 years ago

No, it's not.

src = pha * fgr + (1 - pha) * bgr

The foreground will be exactly the same as src only for pixels where alpha is 1. But for semi-transparent regions, you need to predict the actual foreground.

您好,我数据集只有合成图以及对应的alpha,我该如何进行修改呢,1.必须要对合成图像的 前景、背景分离,这一步该怎么操作,是否可以根据src = pha fgr + (1 - pha) bgr,将bgr设置为白色或者黑色进行合成得到像你给的数据集样子,这样操作正确吗;2.或者将训练代码的预测前景代码进行注释,只进行alpha预测,不预测前景对模型最终的性能影响大不大。