SimpleCRF
SimpleCRF copied to clipboard
dense_crf3d: No segm produced for single modality
Hi taigw,
I am trying to run dense_crf3d on single modality (only T1c).
At first I used: dense_crf_param['BilateralModsStds'] = (3.0)
but that didnt work. So I used dense_crf_param['BilateralModsStds'] = (3.0,)
instead.
These are the parameters I use now and the module runs as well:
dense_crf_param = {}
dense_crf_param['MaxIterations'] = 2.0
dense_crf_param['PosRStd'] = 3.0
dense_crf_param['PosCStd'] = 3.0
dense_crf_param['PosZStd'] = 3.0
dense_crf_param['PosW'] = 1.0
dense_crf_param['BilateralRStd'] = 5.0
dense_crf_param['BilateralCStd'] = 5.0
dense_crf_param['BilateralZStd'] = 5.0
dense_crf_param['ModalityNum'] = 1
dense_crf_param['BilateralW'] = 3.0
dense_crf_param['BilateralModsStds'] = (3.0,)
But the segmentation produced is all zeros.
I did a gridsearch with several random values of PosStds,PosWs,BilateralStds,BilateralWs but its all zero. Do you have any suggestions on this?
@satrajitgithub @MENG1996 Not sure what problem you have. I have updated the code and a demo for single-modality segmentation is added. See examples/demo_densecrf3d.py
for details.
@taigw could you please explain what these parameters stand for? I need to post-process my data and do not know what changes should I do that best suits to my data.
Hi taigw,
I am trying to run dense_crf3d on single modality (only T1c). At first I used:
dense_crf_param['BilateralModsStds'] = (3.0)
but that didnt work. So I useddense_crf_param['BilateralModsStds'] = (3.0,)
instead. These are the parameters I use now and the module runs as well:dense_crf_param = {} dense_crf_param['MaxIterations'] = 2.0 dense_crf_param['PosRStd'] = 3.0 dense_crf_param['PosCStd'] = 3.0 dense_crf_param['PosZStd'] = 3.0 dense_crf_param['PosW'] = 1.0 dense_crf_param['BilateralRStd'] = 5.0 dense_crf_param['BilateralCStd'] = 5.0 dense_crf_param['BilateralZStd'] = 5.0 dense_crf_param['ModalityNum'] = 1 dense_crf_param['BilateralW'] = 3.0 dense_crf_param['BilateralModsStds'] = (3.0,)
But the segmentation produced is all zeros.
I did a gridsearch with several random values of PosStds,PosWs,BilateralStds,BilateralWs but its all zero. Do you have any suggestions on this?
I have a multi-class segmentation problem, once I am giving the probability map of all classes, the output is a blank image (an image with zero values).
I have probability map of 4 classes (0: background, 1: object1, ..., 4: object4) and it has the shape of P: (166, 347, 82, 5)
and I commented the line 31 to line 33, and I
is float values between [0,1]. I commented out the line 27 and 28 in my case.
Then I tried to send only one probability map:
I = np.asarray([I1], np.uint8) # (1, 166, 347, 82)
I = np.transpose(I, [1, 2, 3, 0]) # (166, 347, 82, 1)
# probability map for each class
#P = 0.5 + (P - 0.5) * 0.8
P = np.asarray([1.0 - P, P], np.float32) # (2, 166, 347, 82)
P = np.transpose(P, [1, 2, 3, 0]) # (166, 347, 82, 2)
#pdb.set_trace()
dense_crf_param = {}
dense_crf_param['MaxIterations'] = 40.0 #2.0
This is the output before sending to densCRF algorithm, and need to fill the holes and smooth the edges.
and this is the probability map of single class that I am sending to
densecrf3d
and changed the number of iteration to 40.0
.
then I changed the iterations to 70
, the output did not change:
The questions are:
-
why the algorithm does not work for multi-class probability map? where I am doing mistake?
-
How to change the parameters, which parameters?
Thank you
@sara-eb I have now added a demo for multi-class segmentation, see examples/demo_densecrf.py To understand the meaning of each parameter, please check the original paper: Philipp Krähenbühl and Vladlen Koltun, "Efficient inference in fully connected crfs with gaussian edge potentials", in NIPS, 2011.
hello @sara-eb are you able to figure out why its generating blank image?
@sara-eb Following is my personal understanding of the parameters. @taigw Please correct me if I’m wrong. Thank you for the awesome repository.
dense_crf_param = {}
dense_crf_param['MaxIterations'] = 2.0
# weights of the unary potential
dense_crf_param['PosW'] = 2.0
# standard deviation in the kernel
dense_crf_param['PosRStd'] = 5
dense_crf_param['PosCStd'] = 5
dense_crf_param['PosZStd'] = 5
# weights of the pairwise potential
dense_crf_param['BilateralW'] = 3.0
# standard deviation in the kernel (pairwise potential)
dense_crf_param['BilateralRStd'] = 5.0
dense_crf_param['BilateralCStd'] = 5.0
dense_crf_param['BilateralZStd'] = 5.0
dense_crf_param['ModalityNum'] = 1
dense_crf_param['BilateralModsStds'] = (5.0,)
@JunMa11 Yes, your comments are correct.