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


 

猜你喜欢

转载自blog.csdn.net/qq_30024069/article/details/85312170
num