Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relationship loss #10

Closed
artest08 opened this issue Nov 22, 2023 · 2 comments
Closed

Relationship loss #10

artest08 opened this issue Nov 22, 2023 · 2 comments

Comments

@artest08
Copy link

Hello,

Thank you for your nice study. Why are using (1-target) instead of directly the targets in the focal loss? I am having difficulty in understanding the concept behind that manipulation.

targets = 1 - targets.view(-1).long()

Thanks in advance

@sephyli
Copy link
Contributor

sephyli commented Nov 22, 2023

Hi, thanks for the good questuon.

In TopoNet, we utilize focal loss for relationship loss, proposed to address the imbalance between foreground and background predictions in object detection.
Our implementation employs the built-in version of focal loss from mmdet, available here. In this loss calculation, a ground truth class value of 0 indicates the foreground, while 1 refers the background. However, in our the ground truth of adjacent matrix, 1 denotes a positive connection. So the 1 - target operation is utilized for this gap.

Empirically, the gap come from the implement convenience of detection loss and classification loss. In mmdet, some detection loss will use one-hot operation on the class label by default. For instance, if you replace the focal loss to the cross entropy loss in this scenario, this operation is not need.

A related and detailed discussion can be also found in the OpenLane-V2 repo issue #17.

@artest08
Copy link
Author

Thank you so much. It is an excellent explanation. However, it is weird that mmdet library has implemented in that way :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants