Mean Absolute Error(MAE)
一般记做
M
A
E
{\mathop{\rm MAE}\nolimits}
MAE,平均绝对误差,比较预测结果与真值之间的逐像素绝对值差异:
M
A
E
(
y
,
y
^
)
=
1
n
∑
i
=
0
n
−
1
∣
y
i
−
y
^
i
∣
{\mathop{\rm MAE}\nolimits} (y,\hat y) = {1 \over n}\sum\limits_{i = 0}^{n - 1} {\left| {{y_i} - {{\hat y}_i}} \right|}
MAE(y,y^)=n1i=0∑n−1∣yi−y^i∣
def MAE(pred, gt):
mae = torch.abs(pred - gt).mean()
return mae