why I got very low result of IoU when I compared between two images?

조회 수: 7 (최근 30일)
yasmin ismail
yasmin ismail 2023년 10월 19일
답변: Aneela 2024년 11월 5일 7:08
A = logical(imread('new7027-157.png'));
BW_groundTruth =logical(imread('Label7027_157.png'));
similarity = jaccard(A, BW_groundTruth)
similarity =
0.2822
I created GroundTuth by using Image segmenter App and export it to work space , then i used jaccrad index(IoU) and I got 0.2822 , why I got very law result although both images seem same by eye vision, how to fix it, is it related to the way of creating groundtruth or I missed something to do after labeling before calculationg the similarity? can you help me to fix it please?
I attached the original image (70027-157.jpg) which used in Image segmenter App for labeling, the labeled image is(label7027-157), the model output(new7027-157) which is needed to be evaluated

답변 (1개)

Aneela
Aneela 2024년 11월 5일 7:08
The model output, "new7027-157.png" and the groundtruth "BW_groundTruth" are in "grayscale" format not in "binary" format. The "Jaccard Index" needs binary images, the pixel values should be 0 or 1. This difference lead to a low similarity score.
To address the problem, convert both the images into binary masks by applying a threshold before computing IOU. Convert any pixel values greater than "0" to "1" for the foreground, and assign "0" to all other pixels for the background.
Refer to the following MathWorks documentation on "jaccard" for better understanding: https://www.mathworks.com/help/images/ref/jaccard.html

Community Treasure Hunt

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

Start Hunting!

Translated by