Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dice_average.m and compute size of polyp #4

Closed
hybdxxw opened this issue Nov 9, 2021 · 6 comments
Closed

dice_average.m and compute size of polyp #4

hybdxxw opened this issue Nov 9, 2021 · 6 comments

Comments

@hybdxxw
Copy link

hybdxxw commented Nov 9, 2021

Hi, I wonder to know how can I use the dice_average.m to compute the relationship between dice and the size of polyps. I'm not familiar with matalab , but dice_average.m seems only has a defined function ,I try to call this function in main.m files, but failed. Besides, I also curious about how did you compute the ratio of polyps , does the x axis 0,1,2,3,4,5,6 means the relative size ?

@ShuyueG
Copy link
Collaborator

ShuyueG commented Nov 9, 2021

Hi! How did you use the function, and what errors have you got? Please carefully read the annotations in the code. Note: the arrays AreaR and Dice should have the same length. For i-th case, AreaR(i) is the area ratio (see code comments for its computation) of objects in the image of i-th segmented ground truth (the binary label), Dice(i) is the Dice coefficient computed by using the i-th predicted segmentation result and its ground truth. bin_width depends on the distribution of AreaR.

To your second question, yes, the x-axis means the relative size = # of pixels of polyp / # of total pixels of the image.

@hybdxxw
Copy link
Author

hybdxxw commented Nov 9, 2021

Thanks for the reply.
I add these code into main.m , there are no errors, but the generated pic is just one straight line
[AreaR]=deal(zeros(1,imgNUM));
[r,c] = size(resmap);
AreaR(i) = sum(resmap(:))/(r*c);
dice_average(AreaR,threshold_Dic,0.05)

I also input just AreaR,threshold_Dic in the function for a test ,but the results is the same.

@AngeLouCN
Copy link
Owner

Hi, you don't need to add those code into main.m, because they are for different purposes. The matlab codes in fold eval are used to evaluate the segmentation results by 6 different measurement metrics. The dice_average are used to analyze the relationship between object size and dice accuracy.

@hybdxxw
Copy link
Author

hybdxxw commented Nov 10, 2021

Thanks for the reply.
But how can I input data and run dice_average ? For example, if I want to analyze the relationship between object size and dice accuracy in CVC-ClinicDB, does it means I need to get the dice for every picture in test dataset ,area ratio of objects in images one by one and Width of bins for taking average(bin_width depends on the distribution of AreaR, what does this means?Do I need compute or just input 0.05) ,and put them in arrays, then run dice_average in command window?
Thank you very much for giving me your valuable time for these questions!

@ShuyueG
Copy link
Collaborator

ShuyueG commented Nov 10, 2021

Thanks for the reply. But how can I input data and run dice_average ? For example, if I want to analyze the relationship between object size and dice accuracy in CVC-ClinicDB, does it means I need to get the dice for every picture in test dataset ,area ratio of objects in images one by one and Width of bins for taking average --Yes, you're right.

(bin_width depends on the distribution of AreaR, what does this means?Do I need compute or just input 0.05)
-- no need to compute, just try 0.05 or other values. It depends on the range or density of the AreaRatio. The bin_width plays a role like the bin width when you draw a Histogram of the AreaRatio. It groups similar area ratios together and calculates their means.

,and put them in arrays, then run dice_average in command window? -- Yes, or put it in your codes; just like other Matlab functions.

@MELSunny
Copy link

MELSunny commented Feb 7, 2022

dice average (mDice), please refer to the code from segmentation.
it sums the area of intersect and union, prediction (input), label(target) in all test images.
and then calculate (2 * total_intersection ) / (total_input + total_target)

https://github.com/open-mmlab/mmsegmentation/blob/master/mmseg/core/evaluation/metrics.py

#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants