sadeepj / crfasrnn_keras

CRF-RNN Keras/Tensorflow version
http://crfasrnn.torr.vision
MIT License
603 stars 169 forks source link

Compared to pydensecrf, crfasrnn seems do not have two `compat` parameters. #54

Closed panfengli closed 5 years ago

panfengli commented 5 years ago

For example,

d.addPairwiseGaussian(sxy=3, compat=3)
d.addPairwiseBilateral(sxy=80, srgb=13, rgbim=im, compat=10)

Here theta_alpha is 80, theta_beta is 13 and theta_gamma is 3 which corresponds to the 3 parameters in crfrnn network. However, the two compat parameters seems not available in crfrnn model.

sadeepj commented 5 years ago

Hi @panfengli these parameters in pydensecrf seems to be related to the compatibility matrices and kernel weights. See Section 4.4 of https://www.robots.ox.ac.uk/~szheng/papers/CRFasRNN.pdf for more details.

In https://github.com/sadeepj/crfasrnn_keras/blob/master/src/crfrnn_layer.py#L40, _self.spatial_kerweights, _self.bilateral_kerweights and _self.compatibilitymatrix combined have the same effect as these parameters. All of these are automatically learned using backpropagation during the training of CRF-RNN (please see the above paper for more details).