How to determine dice threshold to measure performance for detection model based on image processing?

4 views (last 30 days)
I am postgradute student and my instructor asked me how can I determine or based of what I choose the threshold for dice to determine (TP, FP, TN, FN) of the model to measure the perfomance of the model based on image image processing.
Can anyone help me to have suitable answer please

Answers (1)

Aastha
Aastha on 13 Aug 2024
Edited: Aastha on 13 Aug 2024
Hi yasmin ismail,
I understand you want to choose a threshold based on dice score for a binary image segmentation problem. According to my understanding, the dice score is a metric applied between two binary images. It provides a score that increases with increase in similarity between two images.
To choose dice threshold, please perform the following steps:
1. Firstly, you will need the segmentation output for each pixel of an input image. This is a score between [0,1] reflecting the confidence of the prediction.
2. To perform segmentation of the image, consider a range of threshold values between [0,1]. Use a for loop iterate through each threshold value and binarize the image.
3. Binarization can be done by marking the pixels with scores greater than the threshold as 1 and less than the threshold as 0. Binarization can be performed by using the MATLAB function “imbinarize(I, T) where I is the original image and T is the binarization threshold.
For more information on “imbinarize” function, refer to the link of MathWorks documentation given below:
https://www.mathworks.com/help/images/ref/imbinarize.html?s_tid=doc_ta
4. For each binarized image corresponding to one threshold value compute the dice score between the binarized image and the ground-truth binarized image. The dice score can be computed using the MATLAB inbuilt function dice”.
dice(BI1, BI2) % BI1 and BI2 are binary images
Refer to MathWorks documentation for more information on “dice” function:
https://www.mathworks.com/help/images/ref/dice.html?s_tid=doc_ta
5. Next, plot the dice-score as a function of threshold values. Finally, choose the threshold value that maximizes the dice-score.
Refer to MathWorks documentation for more information on “plot” function:
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!