Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

VVNN

Loss Function 본문

스터디

Loss Function

vvnn 2021. 7. 5. 20:06

Loss Function 손실 함수

정답값(y)과 예측값(y')을 입력으로 받아 함수값이 최소화되는 가중치(weight)와 편향(bias)을 찾는 것이 목표. 정답과 예측값의 간격(=차이)를 최대한 줄이는 방향으로 값을 대입한다. 이때, 값의 차이를 loss라고 하여 이 loss를 줄이는 방향으로 학습하게 된다. 모델 성능을 결정하는데 있어 필수적인 역할.

 

 

* 학습 종류에 따른 손실함수 이용

Regression(회귀)

- MSE

- MAE

- MSLE

- MAPE

- KLD

- Poisson

- Logcosh

- Cosine Similarity

- Huber

 

Classification(분류)

- Binary cross-entropy

- Categorical cross-entropy

- Sparse categorical cross-entropy

- Hinge

- Squared Hinge

- Categorical Hinge

 

Segmentation(분할)

출처: A survey of loss functions for semantic segmentation, Shruti Jadon

segmentation같은 복잡한 목적의 경우 보편적 loss func를 결정하는 것은 어려움. distribution(분포), skewness(왜도), boundaries(경계) 등 사용하는 데이터 집합 속성에 따라 달라짐. imbalanced segmentation의 경우 focus based loss functions이 잘 작동하고, 균형 데이터 집합의 경우 binary-cross entropy가 잘 작동한다. 약간 치우친 데이터 집합은 dice coefficient가 잘 맞는다. 

 

- Binary cross-entropy 

- Weighted cross-entropy 

- Balanced cross-entropy

- Focal loss

- Distance map derived loss penalty term

- Dice loss

- Sensitivity-Specificity loss

- Tversky loss

- Focal Tversky loss

- Logcosh dice loss

- Hausdorff distance loss

- Shape aware loss

- Combo loss

- Exponential logarithmic loss

- Correlation maximized structural similarity loss

 

# https://github.com/shruti-jadon/Semantic-Segmentation-Loss-Functions/blob/master/loss_functions.py

# https://github.com/nabsabraham/focal-tversky-unet/blob/master/losses.py

# keras에서 제공하는 Loss Function https://keras.io/api/losses/


Dice loss

주로 medical image anaysis에서 사용

 

p: ground truth

p^: prediction

완전히 같으면 dice loss=1이 되어 총 loss는 0

완전히 다르면 dice loss=0이 되어 총 loss는 1

 

*Dice Coefficient

더보기

영상, 이미지 등에서 정답과 예측값의 차이를 알기 위해 사용.

라벨링된 영역(정답, true)과 예측된 영역(pred)이 완전히 같으면 1, 완전히 다르면 0.

loss 평가할 때 사용하는 성능 지표.

 

 

Correlation maximized structural similarity loss

 

 

Tversky loss

작은 병변 검출이 중요한 고도의 불균형 데이터에 대해 훈련할 때 FP보다 FN을 더 가중시키기 위해 Tversky index에 기초한 Tversky loss

P : predicted

G : ground truth 

α는 FP에 대한 패널티(?)의 크기

β는 FN에 대한 패널티(?)의 크기

p0i는 pixel i가 병변일 확률

p1i는 pixel i가 병변이 아닐 확률

g0i는 병변 pixel이면 1이고, 비병변 pixel이면 0

g1i는 병변 pixel이면 0이고, 비병변 pixel이면 1

 

α와 β를 조정하여 False Positive와 False Negative 사이의 균형을 조정할 수 있다.

α=β=0.5인 경우 Tversky index는 Dice coefficient와 동일하게 단순화되며, 이는 F1 score와 동일하다.

α=β=1인 경우 Tanimoto coefficient를 생성하며, α+β=1이 되면 Fβ score의 집합이 생성된다. 

'스터디' 카테고리의 다른 글

code 해석 (~segnet)  (0) 2021.07.14
텐서  (0) 2021.07.14
neg / pos  (0) 2021.07.06
교차 검증(K-Fold Cross Validation)  (0) 2021.07.06
Seg-Net  (0) 2021.07.06
Comments