Skip to content

About best practices for implementing loss functions #1139

Answered by narthchin
minasora asked this question in Q&A
Discussion options

You must be logged in to vote

Take an example from mmdet:
https://github.com/open-mmlab/mmdetection/blob/main/mmdet/models/dense_heads/anchor_head.py
Similarly, you can add loss_cls and more in your model __init__ func and use MODELS.build to build the loss func from your config file, then in your forward function or somewhere else:

losses_cls = self.loss_cls(pred, gt)
return dict(loss_cls=losses_cls)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@minasora
Comment options

Answer selected by minasora
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants