pydensecrf
pydensecrf copied to clipboard
I got a strange mask?
my image:
result:
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))
Did you ever figure it out?