I did a small experiment that tries to test if I can use vl_nnloss to compute the loss of a segmentation with its ground truth mask. The experiment runs like this:
I take one image from MNIST dataset and manually create a ground truth of this image by thresholding.
Similarly, I manually create a "segmentation" with random numbers as scores for each pixel.
I call the vl_nnloss function to compute the segmentation loss by Y = vl_nnloss(impredict, imgt), where "impredict" is a H x W image of segmentation with single type and "imgt" is the single type ground truth, where 1 represents the pixel belongs to the object and 0 represents the background.
The other parameters are using default, which means "loss" is "softmaxloss" ...
However, the returned Y is a mask of zeros. I tried to debug this function step by step and found the the zeros-mask comes from line 216 to 219, where "ex = exp(bsxfun(@minus, X, Xmax)) ;" I am not sure if my way to compute the segmentation loss is correct or not? Can anyone please advise me on that? Thanks!
I believe vl_nnloss ignores zero values (they are treated as "don't care") so you should use the values 1 and 2 in your example. You can look at MatConvNet-FCN for image segmentation.
I did a small experiment that tries to test if I can use vl_nnloss to compute the loss of a segmentation with its ground truth mask. The experiment runs like this:
The other parameters are using default, which means "loss" is "softmaxloss" ...
However, the returned Y is a mask of zeros. I tried to debug this function step by step and found the the zeros-mask comes from line 216 to 219, where "ex = exp(bsxfun(@minus, X, Xmax)) ;" I am not sure if my way to compute the segmentation loss is correct or not? Can anyone please advise me on that? Thanks!