lucasb-eyer / pydensecrf

Python wrapper to Philipp Krähenbühl's dense (fully connected) CRFs with gaussian edge potentials.
MIT License
1.93k stars 411 forks source link

I got a strange mask? #92

Open mohhao opened 5 years ago

mohhao commented 5 years ago

my image: test result: mask I use the code like this:

d = dcrf.DenseCRF2D(640, 368, 4)
prediction1 = prediction1.reshape((4, -1))
d.setUnaryEnergy(prediction1.astype(np.float32))
d.addPairwiseGaussian(sxy=3, compat=3)
cv2.imwrite('test.jpg', (image[i]/.016 + 128).astype(np.uint8))
d.addPairwiseBilateral(sxy=(80, 80), srgb=(13, 13, 13), rgbim=(image[i]/.016+128).astype(np.uint8),compat=10)
prediction1 = d.inference(5)
prediction1 = np.argmax(prediction1, axis=0)
prediction1 = np.reshape(prediction1, (368, 640))
predictio = np.stack((y_type1,y_type2,y_type3), axis=2)
cv2.imwrite('mask.jpg', (prediction1*255).astype(np.uint8))
eduardathome commented 3 years ago

Did you ever figure it out?