zejinwang / Blind2Unblind

This is an official implementation of the CVPR2022 paper "Blind2Unblind: Self-Supervised Image Denoising with Visible Blind Spots".
https://arxiv.org/abs/2203.06967
118 stars 13 forks source link

关于 global masker 部分的代码有一些问题想请教各位老师 #14

Closed Zibo1109 closed 1 year ago

Zibo1109 commented 1 year ago

论文 Figure 2 中提到 “the global masker $\Omega_{(·)}$ hides four spots in y to create a global masked volumes $\Omega_{y}$ consisting of four masked cells $\Omega_{y}^{ij}$, $i,j\in$ {0, 1}”

并且前面也提到 “The pixels in the i-th row and j-th column of each cell are masked and filled with black for illustration”

我的理解是被 masked 的像素值应该为 0,即黑色。这就与下面的代码产生了矛盾:

https://github.com/zejinwang/Blind2Unblind/blob/c76964f2e5f041c6b331195d0af4f3d3f9b51359/train_b2u.py#L299

经过调试发现 filtered_tensor.view_as(tensor) * mask 为将论文 Figure 2 中黑色的像素变成原图原位置卷积后的像素(其余位置像素值为0),与 tensor * mask_inv 相加后会导致图像没有像素值为 0 的部分(我们假设原图所有像素值非0)。或者这样考虑,maskmask_inv 可以看成 “对立事件”,所以在 maskmask_inv 的“系数”都不为 0 的前提下所有像素值也不可能出现0。

所以按我的理解上述代码应该修改为:

return tensor * mask_inv 

这样每 4 个像素必然有一个为 0,即实现了mask

请问我的理解是否正确,希望可以得到答复,谢谢!

zejinwang commented 1 year ago

Your understanding is not entirely accurate. The role of the global mask is to utilize neighborhood bilinear interpolation to replace the intermediate noisy signal. This allows for the implementation of pseudo noise2noise supervision pairs while avoiding identity mapping. This method is fundamentally different from the blind-spot network. The latter performs context inpainting based on pixel-wise independent properties, which often leads to a greater loss of valuable information.