FCNs Check failed: outer_num_ * inner_num_ == bottom[1]->count()

FCNs

问题:

softmax_loss_layer.cpp:47] Check failed: outer_num_ * inner_num_ == bottom[1]->count() (205700 vs. 617100) Number of labels must match number of predictions; e.g., if softmax axis == 1 and prediction shape is (N, C, H, W), label count (number of labels) must be N*H*W, with integer values in {0, 1, ..., C-1}.

解决方案:

问题大概是说,prediction 与label的shape不一致,bottom[1]->count()就是说的label的count等于617100,prediction的outer_num_ * inner_num_等于205700,也就是说label是prediction的3倍。很明显问题出在于,label读取时是3通道,只要把label变为单通道就可以了。

 def load_label(self, idx):
        """
        Load label image as 1 x height x width integer array of label indices.
        The leading singleton dimension is required by the loss.
        """
        im = Image.open('{}/gt/{}.png'.format(self.voc_dir, idx)).convert("1")
        label = np.array(im, dtype=np.uint8)
        label = label[np.newaxis, ...]
        return label

 

 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值