Please see attached the modified code. I have deleted the redundant code and added the dgm::vis::CMarker class represent the results in the same colours.
I saw, that the denseCRF produces worse results. However, I have noticed that with the small amount of iterations (e.g. 1) the result is more or less OK. The best results I got is 86,07% with 1 iteration:
I had approximately the same results with very small classes, when using denseCRF in my experiments with micro-organism dataset.
In order to enhance the results I would suggest to do 2 steps:
- Play with the parameters of the crf.addPairwiseGaussian(3, 3, 3); and crf.addPairwiseBilateral(60, 60, 20, 20, 20, img.data, 10); functions. I think, that the inference may simply “overblur” the minor classes. Reducing “stddev” values may help.
- During the training in DGM, use more train images. That will probably make the unary potentials more strong.