paint-brush
A Deep Dive Into Semantic Segmentation Evaluation Metricsby@ivanpopov
12,486 reads
12,486 reads

A Deep Dive Into Semantic Segmentation Evaluation Metrics

by Ivan PopovJanuary 19th, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Semantic segmentation is an area of computer vision that specialises in dividing an image into regions based on pixel characteristics.
featured image - A Deep Dive Into Semantic Segmentation Evaluation Metrics
Ivan Popov HackerNoon profile picture

Semantic segmentation is an area of computer vision that specialises in dividing an image into regions based on pixel characteristics to identify objects or boundaries, simplifying image analysis. The method has many different use cases, from detecting handwritten words and numbers in scanned documents to Google and Apple employing it for foreground-background separation in portrait mode.


Platforms like Pinterest and Amazon leverage semantic segmentation for image uploading, enabling the identification of similar-looking products by segmenting the area of interest from the rest. Semantic segmentation is a cornerstone for the autonomous vehicle industry, as it helps identify lanes, cars, and pedestrians. This technology is crucial for self-driving cars to comprehend their surroundings through camera video inputs, enabling informed decisions about future actions. Moreover, semantic segmentation finds application in the field of in vitro fertilisation (IVF), particularly during embryo classification. It is used to precisely delineate embryonic structures, contributing to the accurate assessment of embryo development and selection in assisted reproductive technologies.


In this article, I will explore the intricate field of semantic segmentation and explain how to evaluate semantic segmentation efficiency with examples from the embryology field.

Core Concepts of Semantic Segmentation

Semantic segmentation builds upon image classification models, refining the process by labelling each pixel to a predefined class. Pixels of the same class form a segmentation mask, offering precise object classification and boundary delineation.


In this process, an input image undergoes neural network processing, resulting in a colourised feature map where each pixel colour signifies a distinct class label. This spatial understanding allows computers to differentiate objects, separate foreground from background, and automate tasks in robotics.

Understanding Semantic Segmentation

The semantic segmentation process unfolds in distinct steps:


  1. Input Image Processing Initiated with an input image, the semantic segmentation model processes it through a complex neural network architecture.

  2. Neural Network Analysis The neural network dissects the image, extracting intricate features and patterns, and understands the visual content in granular detail.

  3. Pixel-level Classification Unlike traditional image classification, semantic segmentation operates at the pixel level. Each pixel in the image is individually classified, contributing to the creation of a detailed segmentation mask.

  4. Colorised Feature Map The output of the model is a colourised feature map of the image. Each pixel's colour corresponds to a specific class label (usually an integer), distinguishing various objects within the scene.

  5. Grouping Pixels Pixels sharing the same class label are grouped, forming coherent segments in the segmentation mask. It helps to perform the precise identification and localisation of objects.

  6. Spatial Understanding The segmented image offers a spatial understanding and makes it possible for computers to discern objects, separate foreground elements from the background, and grasp the contextual relationships between different entities.


Semantic segmentation, with its pixel-level analysis, provides a foundation for advanced visual comprehension, dramatically changing how machines interpret and interact with visual data.


An example of what an autonomous car sees employing semantic segmentation.


Evaluation Metrics

The predominant class of metrics for semantic segmentation falls under the category of overlap metrics. These metrics measure how well the model's prediction matches the actual details in a given image. This provides important information about how accurate the model is.

Overlap Metrics

The most widely employed overlap metrics include the Dice Similarity Coefficient (DSC) and Intersection over Union (IoU), also known as the Jaccard Index. Both metrics provide a numerical representation of the overlap between ground truth and predicted masks, with values ranging from 0 (no overlap) to 1 (full overlap).


A diagram representing the Intersection over Union (IoU).


Though these metrics provide considerable insights, they have limitations as well. Notably, they cannot discern shape differences, a critical factor in scenarios like blastocyst segmentation in the field of embryology, where accurate prediction of non-trivial shapes is essential.


Boundary-based metrics can help to identify changes in shapes and complement overlap metrics. However, they also have limitations. Although they can detect shape differences, they often overlook the structural peculiarities of masks, such as holes within predictions. This is particularly significant in the context of blastocyst segmentation, where components may contain holes.

Volume-Based Metrics

Another dimension to consider in segmentation is volume accuracy. Metrics based on volume are crucial for checking how accurate semantic segmentation models are. They help to measure the size-related details of the predictions. Two key metrics in this category are Volume Similarity (VS) and Relative Volume Difference (RVD).


Volume Similarity (VS) measures the similarity between ground truth and prediction masks by considering their respective volumes. This metric offers a quantitative assessment of how closely the predicted volume aligns with the actual volume. It helps researchers make a more thorough evaluation of the segmentation accuracy.


Relative Volume Difference (RVD) quantifies the disparity in volume between the ground truth and prediction masks in relation to the volume of the ground truth mask. This metric provides a normalised measure of the volume difference, offering insights into the proportion of discrepancy relative to the true volume.


Volume-based metrics are an effective way to evaluate the performance of semantic models, especially in situations where precise volume prediction is crucial. One major drawback of using such metrics is that they do not consider the location of the predicted mask. As a result, relying solely on them may result in predictions of the correct size but in the wrong place. To address this issue, overlap or boundary metrics should be integrated into the evaluation process.


When evaluating models, it is crucial to select relevant metrics. Although boundary-based, and volume-based metrics can be useful in certain scenarios, they don't consider all of the intricacies of mask structure. The Dice Similarity Coefficient (DSC) is the most versatile and commonly used metric for semantic segmentation evaluation and is recommended as a go-to solution. This choice is in line with the trends observed in state-of-the-art models that focus on blastocyst semantic segmentation. [1] [2] [3]

Challenges

After summarising my experience in analysing semantic segmentation evaluation metrics, it is clear that there are several challenges to accurately assessing the performance of segmentation models. These challenges are mainly related to shape variability, hole recognition, and nuanced volume accuracy measurement. In the following insights, I will outline these key difficulties encountered:


  • Shape Variability Assessment. Existing metrics often struggle to accurately evaluate shape variability, particularly for objects with intricate or non-trivial structures. Capturing diverse shapes, which is utterly important in medical imaging applications or object recognition, becomes a challenging task.


  • Hole Recognition Limitations. Boundary-based metrics commonly used in evaluation may not effectively recognise holes within segmented objects. This limitation impacts the metric's ability to comprehensively assess the structure of objects, especially when internal voids are present.


  • Volume Accuracy Measurement. While volume-based metrics provide insights into volumetric aspects, accurately predicting the volume of each segmented component remains challenging. Relying solely on volume metrics may lead to incomplete evaluations, particularly in scenarios where precise volume prediction is essential.


  • Difficulty in Addressing Spatial Relationships. Evaluating spatial relationships and contextual understanding within the segmented areas is a complex task. Existing metrics may struggle to capture the intricate interplay of objects and their surroundings, limiting the holistic assessment of segmentation quality.


  • Inability to Differentiate Similar Structures. Metrics may face difficulty distinguishing between similar structures, leading to potential misclassification or underestimation of segmentation accuracy. This becomes pronounced in scenarios where objects share visual similarities but have distinct semantic meanings.


  • Limited Adaptability to Domain-Specific Requirements. Evaluation metrics may lack adaptability to specific domains or applications. Thus, to ensure relevant and accurate assessments, it is crucial to fine-tune metrics for domain-specific nuances.


The outlined challenges signify a dynamic scientific landscape that calls for continual refinement in assessment methodologies.


Semantic segmentation is a crucial technology that has wide-ranging applications in areas such as e-commerce, medical imaging, and autonomous vehicles. Its potential to improve people's lives is significant. However, to use it efficiently, we need to be able to measure its accuracy, and evaluating the accuracy remains challenging. Metrics such as the Dice Similarity Coefficient and Intersection over Union are not perfect, as they struggle with shape variability and hole recognition. Therefore, a deeper understanding and improvement of these evaluation metrics is essential. By combining overlap, boundary-based, and volume-based metrics, we can enhance the accuracy of semantic segmentation. This advancement will bring notable benefits to various industries.