Commit a4390091 authored by Kevin Keraudren's avatar Kevin Keraudren
Browse files

The proper syntax is `dcrf.DenseCRF2D(img.shape[1], img.shape[0], M)`.

This has to do with C-ordering versus Fortran ordering, also known as https://en.wikipedia.org/wiki/Row-major_order

This bug appears with the following parameters:

d.addPairwiseGaussian(sxy=3, compat=0)
d.addPairwiseBilateral(sxy=3, srgb=5, rgbim=img, compat=50)

And this is confirmed by this other Python wrapper for densecrf:

see the order (D, W, H) at this line:
https://github.com/mbickel/DenseInferenceWrapper/blob/master/denseinference/lib/libDenseCRF/densecrf.cpp#L139

while the original 2D code is (H,W).
parent 0d10e2bf
...@@ -20,7 +20,7 @@ output = sys.argv[3] ...@@ -20,7 +20,7 @@ output = sys.argv[3]
M = labels.max() + 1 # number of labels M = labels.max() + 1 # number of labels
# Setup the CRF model # Setup the CRF model
d = dcrf.DenseCRF2D(img.shape[0], img.shape[1], M) d = dcrf.DenseCRF2D(img.shape[1], img.shape[0], M)
# Certainty that the ground truth is correct # Certainty that the ground truth is correct
GT_PROB = 0.5 GT_PROB = 0.5
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment