Closed aseembits93 closed 8 years ago
I guess you'll have to experiment with that. I couldn't find anything on that in the paper or in the description. What do your classes represent?
i have an indoor dataset with two labels, table and floor. If i put num_output 2 in the last layer, it gives an error. so i have to put num_output 3.
Have a look at line 1537 in the segnet model.
If you set table=0, floor=1 and your unlabelled pixels to 2 then you can set num_output=2 with ignore_label=2. Hope this helps!
Thanks @alexgkendall . One more thing, what about 'class_weighting:' for different classes in the softmaxwithloss layer? how do I specify those in my case?
No problem! You should follow the example in segnet.prototxt. You can use the formula in our SegNet paper to compute the values on your dataset.
It's mentioned in the cvpr '08 paper on semantic texton forest, right? how could the weighting be more than 1 as its there in segnet_train.prototext?
Hello, @aseembits93. I believe it's mentioned in this paper (http://arxiv.org/pdf/1511.00561v2.pdf). Please search for "We use median frequency balancing" :-) Hope this helped!
"we weight each pixel by αc = median freq/freq(c) where freq(c) is the number of pixels of class c divided by the total number of pixels in images where c is present, and median freq is the median of these frequencies." .Thanks @dk683 !
Another possibility is to use one-hot class vectors with the dimension 2, corresponding to your two classes. For the don't-care pixels, simply set all the elements in the vector to 0; this will effectively make those pixel have a zero contribution to the loss disregarding the output of the softmax function, i.e. the loss doesn't care what you output for those pixels.
@aseembits93 Hello, could please tell me how to realize ''median frequency balancing'' in caffe. I also encounter this problem because of the unbalance classes.
I have my own dataset with 2 classes and a lot of pixels don't belong to either of the classes. I have assigned 0 to such pixels in the label image and 1,2 to the classes. I want to train only for labels 1,2 and not 0. Also how do I assign class weight in the softmax layer of the train.prototext file?