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

语义分割任务如何给每张图设置不同的pos_weight #3660

Open
1 task done
qiangxinglin opened this issue Mar 5, 2024 · 1 comment
Open
1 task done

语义分割任务如何给每张图设置不同的pos_weight #3660

qiangxinglin opened this issue Mar 5, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@qiangxinglin
Copy link

问题确认 Search before asking

  • 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.

请提出你的问题 Please ask your question

GT中除了有类别mask, 还有一些ROI区域, 目的是让模型重点学习ROI区域内的分割细节

list of ROI: [
  [x1, y1, x2, y2],
  [x1, y1, x2, y2],
  ...
]

目前想法是取这些bbox的中心点, 然后基于bbox的长宽生成一张loss weight热力图, 类似于这种 (图里是基于边缘距离生成的)
image

框架内的BCELoss虽然可以有pos_weight入参, 但是感觉不能每张图传不同的值, 请问如何修改代码以达成这个目标?

@qiangxinglin qiangxinglin added the question Further information is requested label Mar 5, 2024
@shiyutang
Copy link
Collaborator

你好,语义分割中损失的权重是根据类别进行叠加的,但是根据你的说明,你需要在空间维度进行损失权重叠加,我们有一个semantic weight的参数,你可以在每次损失计算时将对应权重传入这个参数中:

def _post_process_loss(self, logit, label, semantic_weights, loss):

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

No branches or pull requests

2 participants