SegNet-Tutorial icon indicating copy to clipboard operation
SegNet-Tutorial copied to clipboard

Segmentation always gives a background

Open ANIS87 opened this issue 7 years ago • 4 comments

Hi I use 3 classe {0:background, 1:table, 2:person}. My problem is the background occupation is very higher (pixels equals to background is >70% of image). In training i have often per_class_accuracy =0.99 per_class_accuracy=0 per_class_accuracy= a certain "x" between 0 and 1
or per_class_accuracy =0.99 per_class_accuracy=a certain "x" between 0 and 1
per_class_accuracy=0 but when i test the model i have only 0 values ( all image is a background). I think the problem is due to the class_weighting:0.1 class_weighting:1.12 class_weighting:1.12 Please any help to solve my problem

ANIS87 avatar Mar 10 '17 10:03 ANIS87

Oh... I got the exactly same issue with you. I use only 2 class, and no class_weighting. It turns out to be per_class_accuracy = 1 per_class_accuracy = 0

As I do not use class_weighting, I think something else must be wrong.

Here is my loss layer:

layer { name: "loss" type: "SoftmaxWithLoss" bottom: "conv1_1_D" bottom: "label" top: "loss" softmax_param {engine: CAFFE} loss_param: { ignore_label: 11 normalize: false
} } layer { name: "accuracy" type: "Accuracy" bottom: "conv1_1_D" bottom: "label" top: "accuracy" top: "per_class_accuracy" }

yinzhou-jc avatar Mar 19 '17 06:03 yinzhou-jc

I got a similar output when using 3 classes as well, but I went back and calculated the class_weighting for my dataset for each class, and then it worked great.

nk-dev0 avatar May 04 '17 16:05 nk-dev0

@ANIS87 @yinzhou-jc I am trying to modify segnet_basic to 2 class classification using KITTI data set (http://www.cvlibs.net/datasets/kitti/eval_road.php). I have ended up with the same result as yours (Per class accuracy = 0 or 1 and predicted image has only one class throughout). The only changes I have made so far are:

  1. num_output = 2 2. weight_by_label_freqs: True ignore_label: 0 # I have classes 0 and 1 in my ground truth class_weighting: 0.3780 # @nkrall I have calculated the weights also for my dataset class_weighting: 0.7382 If you have solved the issue by now, could you please advice me on how you solved it?

sandeepvr40 avatar Jul 26 '17 11:07 sandeepvr40

@sandeepvr40 I think you need to change the ignore label. If you have 1 "target" class, you'll need a background class as well in addition to ignore, so depending on how your annotations look, 0 could be background and 1 could be target class, and then something like 255 could be ignore

nk-dev0 avatar Jul 28 '17 03:07 nk-dev0