Closed QChhh123 closed 1 year ago
Thank you for your reply. I may not have described my problem clearly. If I expect feat and mask, how to modify the config file? And, in which part, the feat and mask are passed into the contrastive_loss.
---原始邮件--- 发件人: "Binhui Xie @.> 发送时间: 2023年4月8日(周六) 中午11:36 收件人: @.>; 抄送: @.**@.>; 主题: Re: [BIT-DA/SePiCo] 如果打算像你们那样,给自定义的损失函数传入mask和feat,该如何在mmseg框架下更改? (Issue #17)
Hi @QChhh123
Thank you for being so interested.
First, you can follow the tutorial on MMSegmentation to define a new loss function. https://mmsegmentation.readthedocs.io/zh_CN/latest/advanced_guides/add_models.html#loss
In our repo, you can refer to this file contrastive_loss.py. And if you expect feat and mask in the loss function, the following lines might be helpful. https://github.com/BIT-DA/SePiCo/blob/0774b56e2c566e315a25997b915dd68076606149/mmseg/models/losses/contrastive_loss.py#L349-L355
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
we define a new SEGMENTORS EncoderDecoderProjector
to include the auxiliary head for contrastive loss.
Hope it helps.
Thank you very much for your answer. I have benefited a lot from it
I believe the issue at hand was addressed, as such I'm closing this. Feel free to ask if you have further questions.
Hi @QChhh123
Thank you for being so interested.
First, you can follow the tutorial on MMSegmentation to define a new loss function. https://mmsegmentation.readthedocs.io/zh_CN/latest/advanced_guides/add_models.html#loss
In our repo, you can refer to this file
contrastive_loss.py
. And if you expect feat and mask in the loss function, the following lines might be helpful. https://github.com/BIT-DA/SePiCo/blob/0774b56e2c566e315a25997b915dd68076606149/mmseg/models/losses/contrastive_loss.py#L349-L355