语义分割损失函数
【摘要】
这里面有几个损失函数:
GitHub - MichaelFan01/STDC-Seg: Source Code of our CVPR2021 paper "Rethinking BiSeNet For Real-time Semantic Segmentation"
损失函数代码:
#!/usr/bin/py...
这里面有几个损失函数:
损失函数代码:
-
#!/usr/bin/python
-
# -*- encoding: utf-8 -*-
-
-
-
import torch
-
import torch.nn as nn
-
import torch.nn.functional as F
-
from loss.util import enet_weighing
-
import numpy as np
-
-
-
class OhemCELoss(nn.Module):
-
def __init__(self, thresh, n_min, ignore_lb=255, *args, **kwargs):
-
super(OhemCELoss, self).__init__()
-
self.thresh = -torch.log(torch.tensor(thresh, dtype=torch.float)).cuda()
-
self.n_min = n_min
-
self.ignore_lb = ignore_lb
-
self.criteria = nn.CrossEntropyLoss(ignore_index=ignore_lb, reduction
文章来源: blog.csdn.net,作者:AI视觉网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/121260242
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)