多输出 Keras 的回归损失函数

Regression Loss function for Multi outputs Keras

我正在使用深度学习方法来解决具有多输出(16 个输出)的回归问题,每个输出在 [0,1] 之间,总和为 1。 我对哪个损失函数最适合这个问题感到困惑,我已经测试了 均方误差 平均绝对误差 但神经网络总是预测相同的值。

model = applications.VGG16(include_top=False, weights = None, input_shape = (256, 256, 3))

x = model.output
x = Flatten()(x)
x = Dense(1024)(x)
x=BatchNormalization()(x)
x = Activation("relu")(x)
x = Dropout(0.5)(x)
x = Dense(512)(x)
x=BatchNormalization()(x)
x = Activation("relu")(x)
x = Dropout(0.5)(x)

predictions = Dense(16,activation="sigmoid")(x)


model_final = Model(input = model.input, output = predictions)


model_final.compile(loss ='mse', optimizer = Adam(lr=0.1), metrics=['mae'])

你所描述的听起来更像是一个分类任务,因为你想在最后得到一个概率分布。 因此,您应该在最后一层使用 softmax(例如)并使用交叉熵作为损失度量。