S-aiueo32 / contextual_loss_pytorch

Contextual Loss (CX) and Contextual Bilateral Loss (CoBi).
MIT License
172 stars 45 forks source link

Computation question #1

Open jczh98 opened 4 years ago

jczh98 commented 4 years ago

Origin paper mention that CX(X, X) = 1 while CX(X,Y) = 1/N if X is far from Y. So contextual loss is zero when two images are equal and large when two images are dissimilarity. I found that your code which computes equation (1) uses 1 - CX and I'm confused with this and its result. I wish your help, thanks.

S-aiueo32 commented 4 years ago

@neverfelly Thank you for your pointing. I agree with your interpretation of CX. I don't remember why the inversion was placed in the line... Anyway, according to https://gist.github.com/yunjey/3105146c736f9c1055463c33b4c989da, I'm sure that it was my fault.

On the current master branch, it has been fixed. If you confirm it or have the other questions, please post here.

jczh98 commented 4 years ago

Thanks for your great contribution to the contextual loss package. Also, I found a problem with contextual bilateral loss, the original implementation uses MSE distance instead of L1 distance.

S-aiueo32 commented 4 years ago

CoBi is still under developing because of the OOM during L2 distance computation. I could test it only with L1 so I selected L1 for the computation of spatial loss to keep consistency in the test.

The intrinsic solution is to avoid the OOM but I don't have any idea for memory-efficient computation now.