0
0
Computer Visionml~12 mins

Segmentation evaluation (IoU, Dice) in Computer Vision - Model Pipeline Trace

Choose your learning style9 modes available
Model Pipeline - Segmentation evaluation (IoU, Dice)

This pipeline shows how a computer learns to separate objects in images by predicting masks. It then checks how well the predicted masks match the real masks using two scores: IoU and Dice. These scores tell us how much the predicted and real areas overlap.

Data Flow - 5 Stages
1Input images and ground truth masks
100 images x 128 x 128 pixelsLoad images and their true segmentation masks100 images x 128 x 128 pixels (images), 100 masks x 128 x 128 pixels (masks)
Image of a cat and mask showing cat pixels as 1, background as 0
2Preprocessing
100 images x 128 x 128 pixelsNormalize pixel values to 0-1 range100 images x 128 x 128 pixels (normalized)
Pixel value 150 becomes 0.59
3Model prediction
100 images x 128 x 128 pixelsModel predicts mask probabilities for each pixel100 predicted masks x 128 x 128 pixels (values 0-1)
Pixel predicted as 0.8 means 80% chance of object
4Thresholding
100 predicted masks x 128 x 128 pixels (0-1)Convert probabilities to binary masks using 0.5 cutoff100 binary predicted masks x 128 x 128 pixels (0 or 1)
Pixel 0.8 becomes 1, pixel 0.3 becomes 0
5Evaluation metrics calculation
100 binary predicted masks and 100 ground truth masks x 128 x 128 pixelsCalculate IoU and Dice scores for each mask pair100 IoU scores, 100 Dice scores (values 0-1)
IoU = 0.75, Dice = 0.85 for one image
Training Trace - Epoch by Epoch

Loss: 0.65 |****
       0.50 |******
       0.40 |********
       0.32 |**********
       0.28 |***********
Epochs -> 1    2    3    4    5
EpochLoss ↓Accuracy ↑Observation
10.650.60Model starts learning, loss high, accuracy low
20.500.72Loss decreases, accuracy improves
30.400.80Model getting better at segmentation
40.320.85Loss continues to drop, accuracy rises
50.280.88Training converging with good accuracy
Prediction Trace - 5 Layers
Layer 1: Input image
Layer 2: Model convolution layers
Layer 3: Final sigmoid layer
Layer 4: Thresholding
Layer 5: IoU and Dice calculation
Model Quiz - 3 Questions
Test your understanding
What does an IoU score of 1.0 mean?
APredicted mask is empty
BNo overlap between predicted and true masks
CPerfect overlap between predicted and true masks
DGround truth mask is empty
Key Insight
IoU and Dice scores are important to measure how well a model segments objects in images. They focus on overlap quality, which accuracy alone cannot capture. This helps us understand if the model truly learns to separate objects from background.