How to calculate the precision and recall ( determine FP and FN) for image detection based on image segmentation?
6 views (last 30 days)
Show older comments
IF i used jaccard index and I got value of jaccrad =0.9 if I assume my threshold is 0.5 so if jaccard value >0.5 will be TP and if less will be FP
what about FN?
0 Comments
Answers (1)
Image Analyst
on 20 Nov 2023
Jaccard index is related to how much a "ground truth" binary image overlaps your "test" image. According to the help "similarity = jaccard(BW1,BW2) computes the intersection of binary images BW1 and BW2 divided by the union of BW1 and BW2, also known as the Jaccard index."
So using your definition, you're saying that if they overlap by more than 50%, it detected it correctly -- it's a True Positive. And you're saying that if they overlap by less than 50% it's a False Positive because even though they might overlap some, it's not enough to be considered correct.
A false negative would be if you said there was nothing there (gave a Negative) when there actually was something there.
Look at the different possible cases:
bw1 = true(2,2); % Something there.
bw2 = false(2,2); % Nothing there.
bwHalf = logical([1,1;0,0]);
similarityIndex = jaccard(bw1, bw1)
similarityIndex = jaccard(bw1, bw2)
similarityIndex = jaccard(bw2, bw1)
similarityIndex = jaccard(bw2, bw2)
% Using half overlap
similarityIndex = jaccard(bw1, bwHalf)
similarityIndex = jaccard(bw2, bwHalf)
Case 2 or 3, where the ground truth had something while the test/prediction said there was nothing, both give a Jaccard index of 0. That would be a False Negative -- it said it was negative but it was false because it should have said it was positive.
12 Comments
See Also
Categories
Find more on Detection in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!