This project implements a Bayesian Neural Network (BNN) using SWAG (Stochastic Weight Averaging-Gaussian) for satellite image classification. The approach provides well-calibrated uncertainty estimates and can identify ambiguous test samples.
- Tracks weight statistics during training to fit a Gaussian posterior:
$$\theta \sim \mathcal{N}(\mu_{\text{SWAG}}, \Sigma_{\text{SWAG}})$$ - Supports SWAG-Diagonal and Full SWAG methods.
- Evaluates calibration using the Expected Calibration Error (ECE):
where:
-
$B_m$ is the set of predictions in bin$m$ , -
$\text{acc}(B_m)$ is the empirical accuracy in bin$m$ , -
$\text{conf}(B_m)$ is the average confidence in bin$m$ .
- Implements an asymmetric cost function:
$$\ell(y, \hat{y}) = \begin{cases} 1 & \text{if } \hat{y} = -1 \\\ 3 & \text{if } \hat{y} \neq y \text{ and } \hat{y} \neq -1 \\\ 0 & \text{if } \hat{y} = y \end{cases}$$
- Training: 1800 images (60x60 RGB) with well-defined labels from six land usage types.
- Validation: Includes well-defined and ambiguous samples for calibration.
- Test: Contains ambiguous or unseen combinations of land usage.
- Bayesian Model Averaging (BMA) provides robust predictions:
$$p(y=j | x) = \frac{1}{N} \sum_{i=1}^{N} p(y=j | x, \theta_i)$$ - Visualizations include reliability diagrams and confidence-based prediction samples.
- Final overall cost: 0.837 (ranked 233/275)