Open pratik-segmind opened 4 years ago
My Code:
def mask_smoothen(img, mask, nclasses): mask = mask.astype(np.float32) #mask.astype(np.uint8) image = img height, width, channels = image.shape d = dcrf.DenseCRF2D(height, width, nclasses) labels = mask.T U = unary_from_softmax(labels) U = np.ascontiguousarray(U) print(U.dtype, U.shape) d.setUnaryEnergy(U) d.addPairwiseBilateral(sxy=80, srgb=13, rgbim=image, compat=10) Q = d.inference(5) fine_mask = np.argmax(Q, axis=0).reshape(height, width) return fine_mask
I get the error "Bad shape for unary energy (Need (2, 1053979828), got (39677, 26564))"
My image and masks are large: 39677 x 26564
Can some one help me understand what is happening here.
The readme says that you need to flatten it to the shape (NUM_CLASSES, H*W). Hope that helps!
(NUM_CLASSES, H*W)
resize you pic maybe
My Code:
I get the error "Bad shape for unary energy (Need (2, 1053979828), got (39677, 26564))"
My image and masks are large: 39677 x 26564
Can some one help me understand what is happening here.