NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

BayesNetCNN: incorporating uncertainty in neural networks for image-based classification tasks

Matteo Ferrante, Tommaso Boccato, Marianna Inglese, Nicola Toschi

Introduction

Deep learning models have demonstrated remarkable performance in classification tasks, yet they often suffer from overconfidence. A standard Convolutional Neural Network (CNN) typically produces a point-estimate prediction, even when the input data is ambiguous or significantly different from the training distribution. In high-stakes domains such as medical imaging, this "forced choice" behavior can lead to dangerous misdiagnoses.

This research introduces BayesNetCNN, a hybrid approach designed to address the lack of aleatoric and epistemic uncertainty in traditional architectures. By targeting the diagnosis of Alzheimer’s Disease (AD), the authors demonstrate how incorporating uncertainty metrics allows clinicians to distinguish between high-confidence predictions and cases requiring expert human review.

Methodology

The BayesNetCNN architecture is designed for both computational efficiency and robust uncertainty estimation.

1. Efficient 3D Architecture

To process volumetric brain data, the model utilizes a residual CNN backbone built with 3D depthwise separable convolutions. This design choice significantly reduces the parameter count compared to standard 3D convolutions, mitigating the risk of overfitting on limited medical datasets.

The BayesNetCNN architecture utilizes 3D residual blocks followed by a stochastic Bayesian layer to estimate prediction uncertainty.

2. The Hybrid Bayesian Layer

Rather than implementing a full Bayesian Neural Network (BNN)—which is often computationally prohibitive and difficult to train—the authors employ a "hybrid" strategy. A standard CNN is first trained to convergence. Subsequently, the weights ($w^*$) of the final linear layer are replaced with a Gaussian distribution $N(w^*, s)$. This post-hoc modification endows the model with probabilistic capabilities without the instability of training a full BNN from scratch.

3. Inference and Rejection Mechanism

During inference, the model performs $N=100$ forward passes, sampling weights from the final layer's distribution in each iteration. The mean of these samples provides the final class prediction, while the standard deviation serves as a quantifiable uncertainty metric. A tunable rejection threshold ($t$) is then applied: if the uncertainty exceeds $t$, the case is flagged for manual review rather than being automatically classified.

Data and Preprocessing

The model was evaluated using a subset of the Alzheimer’s Disease Neuroimaging Initiative (ADNI) dataset, comprising 376 cases balanced between AD patients and healthy controls. T1-weighted MRI scans were transformed into Jacobian Determinant (JD) maps to isolate morphometric changes, such as cortical atrophy, from general image intensity variations. Images were coregistered to MNI space and cropped to a $96 \times 96 \times 96$ volume.

Results

The implementation of the Bayesian rejection mechanism led to a significant improvement in diagnostic reliability.

Performance metrics showing the trade-off between the uncertainty rejection threshold, classification accuracy, and the fraction of data automatically classified.

As shown in the results table, a standard non-Bayesian network (equivalent to a threshold where the fraction is 1.0) achieved an accuracy of approximately 0.868. By introducing a strict rejection threshold ($t=0.002$), the accuracy for the remaining cases rose to 0.947 (approximately 95%), with an AUC of 0.959. This performance gain comes at the cost of "coverage"; at this threshold, the model automatically classifies 75% of the test set, referring the most uncertain 25% to experts.

Discussion and Conclusion

The "hybrid" Bayesian approach offers a practical middle ground for clinical AI. By allowing the model to "opt-out" of ambiguous cases, the overall system reliability increases. Furthermore, explainability analysis using Integrated Gradients confirmed that the model focuses on clinically relevant features, such as ventricular enlargement, aligning with established medical knowledge of Alzheimer's progression.

While the current proof-of-concept uses only a single stochastic layer and a relatively small dataset, it demonstrates a clear path forward for safer medical AI. Future work will focus on validating these uncertainty thresholds across larger, multi-site datasets and exploring the impact of making deeper layers of the network Bayesian.

Summary updated

BibTeX
@misc{ferrante2022bayesnetcnn,
  author = {Matteo Ferrante and Tommaso Boccato and Marianna Inglese and Nicola Toschi},
  title = {{BayesNetCNN: incorporating uncertainty in neural networks for image-based classification tasks}},
  year = {2022},
  eprint = {2209.13096},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2209.13096},
}
Figure