weixin_43978059 2022-03-12 13:57 采纳率: 0%
浏览 764
已结题

(InvalidArgument) Input(X) and Input(Label) shall have the same shape except the last dimension.

环境paddleseg2.3 paddle2.2.1
输入图像为两图像叠加成6通道的图像,标签图为单通道。使用unet++可以正常运行,使用unet3+报错。最初报错为
RuntimeError: The length of logits_list should equal to the types of loss config: 5 != 1.
我把paddleseg.core.train文件中第193行的logits_list = logits_list改为logits_list = [logits_list]报错
'list' object has no attribute 'shape'
于是在bceloss文件中增加
label = paddle.to_tensor(label)
logit = paddle.to_tensor(logit)
接着报错ValueError: (InvalidArgument) Input(X) and Input(Label) shall have the same shape except the last dimension. But received: the shape of Input(X) is [5, 1, 2, 512, 512], the shape of Input(Label) is [1, 1, 1, 512, 512].
不知道该从哪再改

  • 写回答

1条回答 默认 最新

  • Mr.郑先生_ 2022-03-12 15:04
    关注

    您好,您改的思路不太对,可以检查一下.yml配置文件里损失函数的配置

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 5月22日
  • 专家修改了标签 3月12日
  • 创建了问题 3月12日