Closed tchaton closed 5 years ago
Thx for interest our project. Our HairMattingLoss for calculating "mask-image gradient consistency loss" part is quite buggy, so we didn't use it temporarily. Add option for your suggestion in this PR
If we use abs
for that term, it can explode, so we add range [0,1]. If there's any other better solution, PR is always welcome. Thank you
One need to ensure that square root and division are not getting nan by adding some small number like 1e-6 as mentioned in this code, add that in square root part too. images were more refined after that as mentioned in the paper, though for me there were still some extra edges from other part of the picture were appearing, they were little none the less. Good enough for hair colour change matting process as mentioned in the original paper.
Hello there,
I would replace torch.sum(torch.mul(G, 1 - torch.pow(I_xG_x + I_yG_y,2)))/torch.sum(G) + 1e-6 by torch.sum(torch.mul(G, torch.abs(1 - torch.pow(I_xG_x + I_yG_y,2))))/torch.sum(G) + 1e-6.
I tried it with only this loss, and it was negative.
Best, T.C