y_true无法识别其形状

时间:2019-04-17 14:08:21

标签: keras loss-function

我想用y_true的一部分来计算自己的损失函数,但我失败了。

def loss_total(self, mask):

    def loss(y_true, y_pred):

        vgg_out = []
        vgg_gt = []
        for i in range(0,9):
            y_pred_single = y_pred[:, :, :, i::9]
            y_true_single = y_true[:, :, :, i::9]


            vgg_out_single = self.vgg(y_pred_single)
            vgg_out = vgg_out.append(vgg_out_single)

            vgg_gt_single = self.vgg(y_true_single)
            vgg_gt = vgg_gt.append(vgg_gt_single)

在“ 调用”中的文件“ /home/dingyuyang/.conda/envs/tensorflow/lib/python3.5/site-packages/keras/engine/base_layer.py”中,行474     output_shape = self.compute_output_shape(input_shape)   文件“ /home/dingyuyang/.conda/envs/tensorflow/lib/python3.5/site-packages/keras/engine/network.py”,行661,在compute_output_shape中     在layers_to_output_shapes中声明键 AssertionError

0 个答案:

没有答案