focal-frequency-loss
focal-frequency-loss copied to clipboard
About the calculation of distance
https://github.com/EndlessSora/focal-frequency-loss/blob/5c34c2cb03bb9b26fa917fd9f032c009599290a5/focal_frequency_loss/focal_frequency_loss.py#L90 Thanks for your work I want to know the calculation of the distance. Euclidean distance needs square operation and why here just "tmp[...,0],tmp[...,1]" what does it mean?
https://github.com/EndlessSora/focal-frequency-loss/blob/5c34c2cb03bb9b26fa917fd9f032c009599290a5/focal_frequency_loss/focal_frequency_loss.py#L89 Thanks for your interest. We performed the square operation in Line 89. We use the squared Euclidean distance. You can consider printing each tensor out to understand the code.
https://github.com/EndlessSora/focal-frequency-loss/blob/5c34c2cb03bb9b26fa917fd9f032c009599290a5/focal_frequency_loss/focal_frequency_loss.py#L89
Thanks for your interest. We performed the square operation in Line 89. We use the squared Euclidean distance. You can consider printing each tensor out to understand the code.
Thank you! Can I regard that (recon_freq - real_freq) as the Euclidean distance?
No. You can regard the square root of freq_distance
in Line 90 as the Euclidean distance. We apply the squared Euclidean distance to ensure a smooth gradient.
No. You can regard the square root of
freq_distance
in Line 90 as the Euclidean distance. We apply the squared Euclidean distance to ensure a smooth gradient.
Thanks for your reply. I don't think I understand what tmp[..., 0], tmp[..., 1] is doing. And If I want to make the distance bigger in other research area whether I could refer to this loss? like 1/FFLoss One problem I face is that the loss does not decrease when it set to 1/FFLoss. Would you have any ideas?
If you would like the frequency distance to be larger as the model is trained, you may try to apply -FFLoss as your objective function.