A differentiable Gaussian Prototype Layer for explainable Segmentation

Michael Gerstenberger, Steffen Maaß, Peter Eisert, Sebastian Bosse · DOI

Abstract

Deep learning models for semantic segmentation often operate as "black boxes," making it difficult to understand the reasoning behind pixel-level classifications. This work introduces a fully differentiable Gaussian Prototype Layer that enables "this-looks-like-that" explainability within end-to-end trainable networks. We present two architectures, ProtoSegNet and ProtoBBNet, which utilize this layer to perform segmentation by comparing image features to learned prototypical representations. Evaluated on agricultural datasets (MinneApple and WGISD), our models achieve near state-of-the-art accuracy while providing clear visual evidence for their decisions, bridging the gap between high-performance segmentation and model transparency.

Introduction

In fields like precision agriculture, understanding the "why" behind a model's "where" is crucial for trust and error analysis. Traditional semantic segmentation models, while accurate, lack inherent interpretability. Prototype-based learning offers a path forward by basing decisions on similarity to representative examples. However, existing methods often rely on non-differentiable algorithms like Expectation-Maximization (EM) for fitting Gaussian Mixture Models (GMMs), hindering seamless integration with deep learning backbones. This paper addresses this limitation by proposing a differentiable Gaussian Prototype Layer.

Methodology

The core innovation is a Gaussian Prototype Layer where the means and covariances of the GMM are learned via backpropagation alongside the feature extractor. This allows the network to optimize its internal representations specifically for prototype-based reasoning.

Network Architectures

We propose two distinct architectures:

  1. ProtoSegNet: This model identifies prototypes within a latent grid generated by a ResNet encoder. It is computationally efficient, using simple upscaling to map prototype activations back to the original image space.
  2. ProtoBBNet: Drawing inspiration from Faster R-CNN, this model employs SLIC superpixels for region proposals. These regions are encoded into latent vectors, allowing for more precise localization and finer-grained prototype matching.
Architectural overview of ProtoSegNet and ProtoBBNet, alongside the "this-looks-like-that" reasoning logic.

Both models undergo a multi-stage training process: dimensionality reduction via an autoencoder, initial GMM fitting, classification head training, and final end-to-end fine-tuning.

Experimental Results

The models were evaluated on the MinneApple (apple segmentation) and WGISD (grape cluster segmentation) datasets. These datasets present significant challenges, including occlusions and high visual similarity between fruit and background.

Performance and Explainability

Our prototype-based models perform remarkably close to standard "black-box" architectures like UNet. ProtoSegNet achieved 96% pixel accuracy on MinneApple, while ProtoBBNet reached 98%. These results are within 2% of top-performing UNet variants.

Beyond raw metrics, the models provide intrinsic explainability. By identifying prototypical image patches, the network reveals the visual features it considers most representative of each class. For instance, the models learned to distinguish fruit based on specific skin textures and identified "dry grass" as a key feature for background classification in vineyards.

Grid of prototypical image patches learned by the model, representing visual evidence for different classes.

Discussion and Limitations

The use of anisotropic Gaussian kernels allows the models to capture complex data distributions with fewer prototypes. However, the multi-stage training pipeline adds complexity compared to standard models. Additionally, while pixel accuracy is high, the Class Intersection over Union (IoU) for fruit classes was slightly lower than UNet, indicating potential room for improvement in boundary precision.

Conclusion

This work demonstrates that explainability in semantic segmentation does not require a significant sacrifice in performance. The differentiable Gaussian Prototype Layer enables the creation of transparent models that provide human-interpretable evidence for their predictions, opening doors for interactive AI systems where users can refine model behavior by adjusting learned prototypes.

Summary updated

BibTeX
@inproceedings{gerstenberger2023differentiable,
  author = {Michael Gerstenberger and Steffen Maaß and Peter Eisert and Sebastian Bosse},
  title = {{A differentiable Gaussian Prototype Layer for explainable Segmentation}},
  booktitle = {ICIP},
  year = {2023},
  url = {https://openreview.net/forum?id=gGOOin4eBl},
}
Figure