Abstract
While convolutional neural networks (CNNs) trained by back-propagation have seen unprecedented success at semantic segmentation tasks, they are known to struggle on out-of-distribution data. Markov random fields (MRFs) on the other hand, encode simpler distributions over labels that, although less flexible than UNets, are less prone to over-fitting. In this paper, we propose to fuse both strategies by computing the product of distributions of a UNet and an MRF. As this product is intractable, we solve for an approximate distribution using an iterative mean-field approach. The resulting MRF-UNet is trained jointly by back-propagation. Compared to other works using conditional random fields (CRFs), the MRF has no dependency on the imaging data, which should allow for less over-fitting. We show on 3D neuroimaging data that this novel network improves generalisation to out-of-distribution samples. Furthermore, it allows the overall number of parameters to be reduced while preserving high accuracy. These results suggest that a classic MRF smoothness prior can allow for less over-fitting when principally integrated into a CNN model.
Introduction
Deep learning, particularly the U-Net architecture, has become the standard for medical image segmentation. Despite its success, these models often suffer from poor generalization when encountering "domain shift"—variations in image appearance caused by different scanner manufacturers, field strengths, or pulse sequences. Standard CNNs are highly flexible, making them prone to overfitting the specific characteristics of their training data. In contrast, classical probabilistic methods like Markov Random Fields (MRFs) encode robust spatial priors, such as the assumption that neighboring voxels likely belong to the same tissue class. However, MRFs lack the representational power of deep neural networks. This work proposes the MRF-UNet, a hybrid architecture that combines the strengths of both approaches.
Methods: The Product of Experts Framework
The MRF-UNet is designed as a "Product of Experts" (PoE), where the U-Net and the MRF act as independent experts providing probability distributions over labelings. The final segmentation is derived from the product of these distributions.
Because the exact product is computationally intractable, the authors employ a mean-field approximation. This converts the inference process into an iterative update rule, which is implemented as a recurrent layer. This allows the entire system to be trained end-to-end via backpropagation. Crucially, unlike Conditional Random Fields (CRFs), the MRF component here is a prior on labels only and does not depend on image intensities. This independence prevents the model from learning scanner-specific noise patterns, thereby enhancing its ability to generalize to unseen data.
Experimental Setup
The model was evaluated on 3D neuroimaging tasks involving four classes: Gray Matter (GM), White Matter (WM), Ventricles (VEN), and Other (OTH).
- In-Distribution Data: T1-weighted MRIs from the MICCAI 2012 dataset (30 subjects) were used for training.
- Out-of-Distribution (OOD) Data: T1-weighted MRIs from the MRBrainS18 dataset (7 subjects), acquired at a different site with a different scanner, were used to test robustness.
Results and Discussion
The MRF-UNet demonstrated superior performance and efficiency compared to standard U-Net baselines.
Performance and Generalization
On in-distribution data, the MRF-UNet achieved median Dice scores of approximately 0.92. The advantage became more significant on OOD data; for the smallest tested architecture, the MRF-UNet reached a Dice score of 0.73, significantly outperforming the standard U-Net's 0.67. This suggests that the MRF acts as an effective regularizer, preventing the CNN from making erratic predictions when faced with unfamiliar image contrasts.
Parameter Efficiency
The integration of the MRF allows for a "separation of concerns." The MRF handles basic spatial consistency (smoothness), freeing the U-Net to focus on complex feature extraction. Consequently, an MRF-UNet with fewer filters can outperform a much larger standard U-Net. The MRF component itself is extremely lightweight, adding negligible parameter overhead (less than 0.0001% for large models).
Conclusion
The MRF-UNet provides a principled way to integrate classical spatial priors into deep learning architectures. By using a Product of Experts approach and mean-field inference, the model achieves better generalization to out-of-distribution medical data while maintaining high parameter efficiency. Future work will explore larger MRF neighborhoods and validate the approach across diverse medical imaging modalities and anatomical structures.
Summary updated