小编Men*_*rel的帖子

keras/tensorflow 中语义图像分割的多类加权损失

给定批量 RGB 图像作为输入,shape=(batch_size, width, height, 3)

多类目标表示为 one-hot,shape=(batch_size, width, height, n_classes)

以及最后一层具有 softmax 激活的模型(Unet、DeepLab)。

我正在寻找 kera/tensorflow 中的加权分类交叉熵损失函数。

class_weight中的论点似乎fit_generator不起作用,我在这里或https://github.com/keras-team/keras/issues/2115中没有找到答案。

def weighted_categorical_crossentropy(weights):
    # weights = [0.9,0.05,0.04,0.01]
    def wcce(y_true, y_pred):
        # y_true, y_pred shape is (batch_size, width, height, n_classes)
        loos = ?...
        return loss

    return wcce
Run Code Online (Sandbox Code Playgroud)

deep-learning keras tensorflow semantic-segmentation

5
推荐指数
1
解决办法
8690
查看次数