728x90
반응형
SMALL
https://arxiv.org/abs/1805.02798
Combo Loss: Handling Input and Output Imbalance in Multi-Organ Segmentation
Simultaneous segmentation of multiple organs from different medical imaging modalities is a crucial task as it can be utilized for computer-aided diagnosis, computer-assisted surgery, and therapy planning. Thanks to the recent advances in deep learning, se
arxiv.org
Combo Loss는 거짓 긍정 또는 거짓 부정에 각각 페널티를 주는 추가 상수가 있는 CELoss와 Dice Loss의 조합입니다.
#PyTorch
ALPHA = 0.5 # < 0.5 penalises FP more, > 0.5 penalises FN more
CE_RATIO = 0.5 #weighted contribution of modified CE loss compared to Dice loss
class ComboLoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super(ComboLoss, self).__init__()
def forward(self, inputs, targets, smooth=1, alpha=ALPHA, beta=BETA, eps=1e-9):
#flatten label and prediction tensors
inputs = inputs.view(-1)
targets = targets.view(-1)
#True Positives, False Positives & False Negatives
intersection = (inputs * targets).sum()
dice = (2. * intersection + smooth) / (inputs.sum() + targets.sum() + smooth)
inputs = torch.clamp(inputs, eps, 1.0 - eps)
out = - (ALPHA * ((targets * torch.log(inputs)) + ((1 - ALPHA) * (1.0 - targets) * torch.log(1.0 - inputs))))
weighted_ce = out.mean(-1)
combo = (CE_RATIO * weighted_ce) - ((1 - CE_RATIO) * dice)
return combo
출처 : https://www.kaggle.com/code/sungjunghwan/loss-function-of-image-segmentation
728x90
반응형
LIST
'Paper > Segmentation' 카테고리의 다른 글
[논문리뷰]Mask DINO : Towards A Unified Transformer-based Framework for Object Detection and Segmentation (작성중) (0) | 2023.06.20 |
---|---|
Focal Loss ( 초점 손실 함수 ) (0) | 2023.06.13 |
UNet3+ (0) | 2023.06.05 |
U-Net++ (0) | 2023.06.01 |
U-Net (0) | 2023.06.01 |
댓글