I am very new with MRF
and not that much good at programming.
I have obtained probability map from semantic segmentation using a CNN, I have to optimize the segmentation by using Markov Random Fields (MRF).
I download the code provided by Shai Bagon in this link GCmex. Energy minimization is performed based on either alpha expansion or swap.
I compiled the code by mex and I need to refine the Unary and pair-wise energy minimization functions. I have a stack of images and need to extract the 6-neighborhood grid and include the refined neighboring in the pair-wise function.
The input to the Unary function is the probability map which is a stack with size (256,256,4) for 4 different classes:
My questions are: Has someone refined the code according to the defining different energy function 1) I wanna change Unary and pair-wise formulation). Which functions and which parts of code should be refined and recompiled again?
2) How to change the w_i,j
? it is calculate based on intensity difference, here we have only probabilities, Is it the difference of probabilities of two adjacent voxels?
I really appreciate your help. Thanks