Paper · 2021-08-03 · cs.LG, cs.CV, cs.IT, stat.ML
Robust Compressed Sensing MRI with Deep Generative Priors
Posterior sampling for compressed-sensing MRI: a score-based prior trained on T2 fastMRI brain slices, with no knowledge of the sampling pattern, reconstructs multi-coil k-space by annealed Langevin dynamics. Author-reported: competitive with supervised baselines in-distribution and more robust under mask and anatomy shifts, at about 16 minutes per high-resolution brain on an RTX 2080Ti.
Diffusion modelsGenerative priors for inverse problemsmricompressed-sensingposterior-samplinglangevin-dynamicsscore-based-modelsinverse-problems
arXivPDFCodeMarkdown14 min read
AI-compiled by claude-haiku-5-5 on 2026-10-18, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
An MRI machine measures only part of the data it could collect, because a shorter scan is kinder to the patient. The image then has to be rebuilt from partial measurements. A common approach trains a network on many scans with one fixed measurement pattern. Such networks can do poorly when the scan looks different from their training data.
This paper trains a generative model on brain scans only and uses it as a prior, meaning a learned sense of what a plausible brain image looks like. To rebuild an image, the method starts from noise and repeatedly nudges it in two directions: toward images that the model considers plausible, and toward images that agree with the measurements actually taken. The size of these nudges is gradually reduced, so the process settles on a final image. The model never sees the measurement pattern during training, so the same model can be used with other patterns and with other body parts.
The authors report that the method is competitive with supervised networks when the test scan resembles the training data, and that it holds up better when it does not. The price is speed: one reconstruction takes minutes rather than the seconds that supervised networks need. Because each run starts from different noise, repeated runs give a spread of images, and that spread can show which pixels the method is unsure about.
TL;DR
- Posterior sampling with a score-based prior for brain MRI (NCSNv2 trained on T2 fastMRI brain slices), run as annealed Langevin dynamics on the multi-coil k-space forward model §2.1 §2.2 §4 eq. 4.
- The prior is trained without the sampling pattern, so the same weights serve other patterns and anatomies §4.2 §6.
- Author-reported: competitive with supervised baselines in-distribution (better PSNR, lower SSIM at R = 3 and 6), and more robust under sampling and anatomy shifts §4.1 §4.2.
- Cost: 16 minutes and 0.95 GB for one high-resolution brain on an RTX 2080Ti §4.1.
- The released code departs from the equations in several places. See Paper vs code before implementing.
Problem
Compressed sensing reduces the number of k-space measurements needed for MRI, which shortens scans §1. Sparsity-based methods are limited in the acceleration they reach §1. Supervised deep networks reconstruct well when test data match training data, but their quality drops under out-of-distribution shifts in the sampling pattern or the anatomy §1 §4.2.
Compressed Sensing with Generative Models (CSGM) instead trains a generative model on the images and reconstructs by searching the model's range. It does not depend on the measurement pattern at training time §1. Before this paper, CSGM had worked mainly on faces and digits, and it is known to perform poorly on out-of-distribution samples §1.
The paper's theory covers the case where the generator's distribution differs from the true one. Its guarantees use Gaussian measurement matrices, and it notes that they do not carry over to Fourier measurements in general §3.
Method
Forward model. A coil with sensitivity map S_i measures the image x through the Fourier transform F and a sampling operator P, plus noise eq. 1 §2.1. The same sampling pattern applies to every coil. The reference image is the minimum-variance unbiased estimate (MVUE) from the fully sampled data, built with ESPIRiT sensitivity maps §2.1 §4.
Posterior sampling. For a measurement y = A x + w with Gaussian noise and a prior mu, the output is a draw from the posterior mu(x | y) §2.2. Langevin dynamics produces such draws from the score of the posterior eq. 3 §2.2. Annealed Langevin dynamics uses a family of noise-perturbed priors, each with its own score, going from large to small noise §2.2.
Score model. The prior is a score network trained with annealed denoising on T2-weighted brain slices from the NYU fastMRI dataset, 3 T, 14,539 two-dimensional training slices §4. The network is NCSNv2 §4 app. G.1. Its input and output have two channels, the real and imaginary parts, and it is trained on 384 by 384 images app. G.1.
Algorithm. The paper's final update is an annealed Langevin step with a data term eq. 4 §2.2. The gradient of the measurement likelihood is A^H(y - A x) divided by sigma^2 + gamma_t^2, where gamma_t decreases over time. The paper states this but gives no values for sigma, gamma_t, the step sizes eta_t or the number of noise levels T §2.2.
x_{t+1} = x_t + \eta_t \left( f(x_t; \beta_t) + \frac{A^H (y - A x_t)}{\gamma_t^2 + \sigma^2} \right) + \sqrt{2\eta_t}\, \zeta_t, \qquad \zeta_t \sim \mathcal{N}(0, I) \qquad [\text{eq. 4}]
Here f is the score of the prior at noise level beta_t, and the initial state is drawn from a standard complex Gaussian §2.2. The paper states that T and the beta_t were fixed during training of the score model, so inference only sets eta_t, sigma and gamma_t §2.2.
# Posterior sampling by annealed Langevin [eq. 4] [§2.2]
# Input: y (masked k-space), A (coil maps and mask), score f
# Output: one posterior sample x, complex (H, W)
def posterior_sample(y, A, score, eta, gamma, sigma):
# Initial state from a standard complex Gaussian [§2.2]
x = complex_normal(0, 1, shape=(H, W))
for t in range(T):
# Prior term at the current noise level [§2.2] [eq. 4]
prior_grad = score(x, t)
# Data term with its annealed scale [§2.2] [eq. 4]
residual = y - forward(A, x)
data_grad = adjoint(A, residual) / (gamma[t] ** 2 + sigma ** 2)
# Noise with variance 2 * eta_t [§2.2] [eq. 4]
noise = normal(0, 1, shape=(H, W)) * sqrt(2 * eta[t])
x = x + eta[t] * (prior_grad + data_grad) + noise
return xNormalisation. During training, each image is divided by its 99th-percentile pixel value. At inference, the reconstruction is scaled using the 99th percentile of the pseudo-inverse image, since the ground truth is unavailable app. G.1.
Uncertainty. Several independent posterior samples can be averaged, and their pixel-wise standard deviation estimates the error at each pixel §4.3. For a knee at R = 4, the paper uses 48 reconstructions fig. 4.
Hyperparameters
The paper's appendix refers readers to the GitHub repository for the sampler values app. G.1. The values below come from the repository's brain_T2 configuration, unless marked as stated in the paper. The other anatomy configurations differ in some values, listed under Paper vs code.
| Name | Value | Where | Notes |
|---|---|---|---|
| Score model | NCSNv2, two channels (real, imaginary) | §4 app. G.1 | Architecture otherwise unchanged; the NCSNv2 source is a git submodule that is empty in the snapshot (.gitmodules) |
| Training data | 14,539 T2 slices, 3 T, NYU fastMRI brains | §4 | Only the score model's training run is described; no iteration count is given in the paper |
| Training image size | 384 by 384 | app. G.1 brain_T2.yaml | Other shapes are handled by convolution app. G.1 |
| Noise levels (T) | 2311 | brain_T2.yaml | Not stated in the paper |
| Noise schedule | geometric, from sigma 232 down to 0.0066 | app. G.1 brain_T2.yaml | Values match the paper; the schedule function is in the missing NCSNv2 submodule |
| Base step size | 5e-5 | brain_T2.yaml | Enters the step as step_lr times (sigma_t / sigma_end)^2 main.py |
| Inner steps per level | 4 (3 for levels up to 1800) | brain_T2.yaml main.py | The paper does not state an inner step count |
| Start level | levels up to 1155 skipped | brain_T2.yaml main.py | Not in the paper |
| Data-term weight | 5.0 | brain_T2.yaml main.py | Not in the paper; see Paper vs code |
| Parameter EMA | on, rate 0.999 | brain_T2.yaml main.py | Not in the paper |
| Checkpoint used | NCSNv2 at 100,000 iterations | brain_T2.yaml | Weights are downloaded separately (README.md); their license is not stated in the paper |
| Score network options (config) | InstanceNorm++, ELU, 128 base channels, no spectral norm | brain_T2.yaml | Not in the paper |
| Training options (config) | Adam, lr 1e-4, beta1 0.9, batch 4, 320,001 iterations | brain_T2.yaml brain_T2.yaml | Not in the paper; the used checkpoint is at 100,000 iterations |
| Acceleration | R = 4 (default) | brain_T2.yaml | Paper tests R from 2 to 12 fig. 1 app. C |
| Sampling pattern | equispaced, vertical lines | brain_T2.yaml | Paper also tests horizontal and random masks §4.2 |
| Auto-calibration lines | 8% of phase-encode lines for 1 < R ≤ 6, else 4% (30 lines at 384) | dataloaders.py | The paper says only "central portion" §4 |
| Equispaced mask | every R-th line outside the centre | dataloaders.py | See Pitfalls for the effective rate |
| Sensitivity maps | ESPIRiT, BART v0.6.00, ecalib -m1 -W -c0, per slice | §4 app. G estimate_maps.py | Calibration-region size is not set in the code |
| Seed | 42 | brain_T2.yaml main.py | |
| Batch size (sampling) | 1 | brain_T2.yaml | |
| Metric | PSNR and SSIM on magnitude images vs MVUE | §4 | Metric code is not in the repository |
| Masked metric | zero out pixels below 0.05 times the peak MVUE magnitude | app. A | Used for Figures 6 and 7 |
| MoDL baseline | 6 unrolls, 6-layer residual backbone, 64 channels, 36 CG steps, Adam lr 2e-4, grad clip 1, batch 1 | app. G.3 | Epoch count conflicts with §4; see Pitfalls |
| E2E-VarNet baseline | 12 unrolls, U-Net with 18 first-stage channels (29M parameters), sensitivity U-Net (0.7M), Adam lr 2e-4 halved at epoch 20, grad clip 1, batch 1 | app. G.2 | Epoch count conflicts with §4; see Pitfalls |
| ConvDecoder baseline | brain architecture of prior work, 10,000 fitting iterations | §4 | |
| l1-Wavelet baseline | BART, lambda = 0.01 chosen on training brains | §4 | Baseline code is not in this repository |
Results
Author-reported. Setup: retrospective under-sampling of fastMRI brain, knee and abdomen scans, and Stanford knees, with baselines trained on MVUE targets §4 app. A.1. The score model is trained on T2 brains only §4. Metrics are PSNR and SSIM on magnitude images §4. The paper gives the key comparisons in figures. Their numbers are not stated in the text, so only the figure references are given here.
Figure-only results. PSNR across acceleration factors and anatomy shifts is in fig. 2. SSIM is in fig. 5, masked SSIM in fig. 6, masked PSNR in fig. 7, and fat-suppressed knees in fig. 20. Stanford knees under Poisson masks are in fig. 24. The authors report no statistical difference between l1-Wavelet, MoDL and their method on that dataset fig. 24.
Qualitative claims §4.1 §4.2:
- In-distribution (vertical equispaced masks, R = 3 and 6): baselines have higher SSIM, while this method has higher PSNR. At higher accelerations it surpasses the baselines fig. 1.
- Sampling shift (horizontal masks, R = 3): this method keeps its performance. E2E-VarNet shows aliasing artefacts there fig. 1.
- Anatomy shift: this method, MoDL and l1-Wavelet keep their advantage on abdomen scans, while ConvDecoder and E2E-VarNet degrade severely §4.2. On knees it gives the best results at R = 2 and 4, with lower variance §4.2.
| Setting | Metric | Baseline | This paper | Source |
|---|---|---|---|---|
| High-resolution brain, RTX 2080Ti | time, memory | ConvDecoder: over 80 min, 6.6 GB | 16 min, 0.95 GB | §4.1 |
| Brain, end-to-end methods | time, memory | "on the order of seconds", 3.5 GB | not applicable | §4.1 |
| Radiologist ranking, knees (lower is better, 1 to 3) | mean rank (SD) | MoDL 1.87 (0.34); ConvDecoder 2.97 (0.18) | 1.17 (0.45) | tab. 1 |
| Radiologist ranking, abdomen | mean rank (SD) | MoDL 1.87 (0.76); ConvDecoder 2.17 (0.93) | 1.97 (0.71) | tab. 1 |
| Radiologist ranking, brain | mean rank (SD) | MoDL 2.00 (0.82); ConvDecoder 2.07 (0.77) | 1.93 (0.85) | tab. 1 |
| Radiologist p-values (Wilcoxon), knees | p | vs MoDL 1.53e-10; vs ConvDecoder 2.77e-6 | (comparison) | tab. 2 |
| Radiologist p-values, abdomen and brain | p | vs MoDL 0.610 and 0.767; vs ConvDecoder 0.340 and 0.550 | (comparison) | tab. 2 |
The radiologist study used three experts, with 30 scores per anatomy app. H. The authors call it preliminary, and they state that it is not a clinical evaluation app. H.
Theory §3:
- Theorem 3.3 (Gaussian measurements). If the true and generator distributions are close in the (delta, alpha)-W_infinity divergence with parameter epsilon, and the number of measurements M grows like log(1/(1 - alpha)) plus a covering-number term, then posterior sampling recovers x within c(epsilon + sigma) with probability at least 1 - delta - exp(-Omega(M)). The constant c is universal but not given §3.
- Theorem 3.4 (arbitrary measurements). If some algorithm is within epsilon with probability 1 - delta, posterior sampling is within 2 epsilon with probability at least 1 - 2 delta §3 app. B.
- Lemma (appendix B): W_q-closeness implies (delta, delta)-W_infinity closeness with epsilon divided by delta^(1/q) app. B.
Paper vs code
Code: official repository https://github.com/utcsilab/csgm-mri-langevin at commit 91e0a5ac658feaf6460045706ef16dd140894374, MIT licence LICENSE. The paper's abstract links it. The owner is the Computational Sensing and Imaging Lab at UT Austin, which is the lab of author Jonathan I. Tamir. Code citations below refer to that commit. Score-model training code and the NCSNv2 sources are not in the snapshot, because the ncsnv2 submodule is empty (.gitmodules). The baseline code is not in the repository either.
- Data-consistency term. The paper's update divides the measurement gradient by sigma^2 + gamma_t^2 eq. 4 §2.2. The code does not use sigma or gamma. It normalises the measurement gradient to unit norm, rescales it to the norm of the prior score, and multiplies by 5.0 main.py brain_T2.yaml. The paper states no value or rule for sigma or gamma_t. Treat the code's rule as what produced the published results, and note that it is not the stated equation.
- Initial state. The paper draws the start from a standard complex Gaussian §2.2. The code draws each of the two channels uniformly from [0, 1) main.py.
- Starting noise level. The paper runs the whole annealing schedule. The code skips every level up to
start_iter= 1155 main.py brain_T2.yaml. The config's comment calls this a different starting noise level. - Inner steps. The paper does not state a step count per level. The code uses 3 steps for levels up to 1800 and the configured count above that, with 1800 hard-coded main.py.
- Step size. The paper calls the step size eta_t and gives no value eq. 4. The code uses step_lr times (sigma_t / sigma_end)^2 main.py.
- Parameter averaging. The code loads an exponential moving average of the score network's weights, with rate 0.999 main.py. The paper does not mention it.
- Normalisation. The paper uses the 99th percentile of the pseudo-inverse image app. G.1. The code takes the 99th percentile of a coil-combined image from the masked k-space main.py utils.py. The coil combination is a SENSE-style weighted sum, which is not the same as a pseudo-inverse.
- Sampling pattern. The paper says R is the true acceleration N / L §2.1. For R = 4 at 384 lines, the code keeps 30 centre lines and every fourth outer line, which gives 119 of 384 lines. That is about 3.2 times, by our count from the code. The paper's footnote says the code's definition differs from fastMRI's §2.1.
- Sensitivity maps. The paper computes ESPIRiT from the fully sampled central portion of k-space §4. The code runs
ecalibon the full k-space of each slice estimate_maps.py. It does not set the calibration-region size. - Only one batch is processed. The main loop breaks after the first batch of the loader main.py. The released script therefore reconstructs one slice per run, which is marked as a leftover in the code.
- Other configurations differ. The paper says one set of hyperparameters was tuned on two brain scans and reused for all anatomies and accelerations app. G.1. The configurations differ: the inner step count is 3 for
brain_T1,brain_FLAIR,kneesandstanford_knees, and 4 forbrain_T2andabdomenbrain_T1.yaml abdomen.yaml. Thebrain_T1andbrain_FLAIRconfigurations do not setstart_iter, whichmain.pyreads main.py. We did not run the code, so we did not confirm whether this fails. - Hard-coded CUDA. The gradient is cast to
torch.cuda.FloatTensormain.py, so the sampler needs a GPU. - Matches. The image size of 384 by 384 for brains, the geometric noise schedule from 232 to 0.0066, the two-channel representation and the NCSNv2 backbone match app. G.1 brain_T2.yaml brain_T2.yaml.
Pitfalls
- The equation is not the algorithm. Eq. 4 has sigma and gamma_t, which the paper never gives values for. The released sampler uses a different data term and extra rules (see Paper vs code). An implementer who follows only the paper will not get the published numbers, and one who follows only the code will get rules the paper does not describe.
- Epoch counts conflict in the paper. The main text says MoDL and E2E-VarNet were trained for 40 and 15 epochs, respectively §4. The appendix says E2E-VarNet for 40 epochs app. G.2 and MoDL for 15 app. G.3. The two readings disagree on which baseline gets which count.
- Theorems do not cover the experiments. Theorem 3.3 assumes Gaussian measurements with specific normalisations and a noise level sigma at least of order epsilon §3. The experiments use Fourier masks, and the paper says the result does not carry over to Fourier measurements in general §3.
- Effective acceleration. Because the equispaced rule keeps every R-th outer line plus the centre, the sampled fraction is above 1 / R dataloaders.py dataloaders.py. Compare results with the paper's nominal R and the code's sampled fraction.
- Metrics are not comparable with RSS references. The paper's references are MVUE images, which give different numbers from RSS-trained leaderboard results. It reports an SSIM of slightly above 0.8 between MVUE and RSS on T2 brains, and quotes fastMRI leaderboard figures for RSS-based methods app. A.1. Do not compare the numbers directly.
- Output varies from run to run. The reconstruction is a random draw from the posterior. Results and uncertainty maps depend on the random seed and on the number of samples taken §4.3.
- Cost scales with the schedule. By our count from the brain_T2 configuration, reconstructing one image runs about 3,975 score evaluations: 645 levels at 3 steps and 510 levels at 4 steps. This is derived from the code, not stated in the paper. The paper reports 16 minutes on an RTX 2080Ti §4.1.
- Dynamic range. Training normalises each image by its 99th-percentile pixel value, which the paper says is needed because MRI values span orders of magnitude app. G.1. Skipping the scale breaks the step size.
- Scope. All data are retrospectively under-sampled, and the study covers fast spin-echo imaging only §5. The authors list fairness across protected attributes as an open issue §5.
- Training code is missing. The score model is trained with NCSNv2 changes described only in the appendix app. G.1. The repository does not include the training loop, so the training normalisation and noise-level function cannot be checked from it.
Lineage
- Builds on: CSGM, the generative-prior framework for compressed sensing of Bora et al. §1; posterior sampling for compressed sensing §2.2; NCSNv2 for the score model §4 app. G.1 (the repository's README gives arXiv:2006.09011 for the earlier score-based work, README.md).
- Compared against: l1-Wavelet with BART, MoDL, E2E-VarNet, and ConvDecoder §4.
- Superseded by: not stated in this wiki.
Source and license
Adapted from “Robust Compressed Sensing MRI with Deep Generative Priors” by Ajil Jalal, Marius Arvinte, Giannis Daras, Eric Price, Alexandros G. Dimakis, Jonathan I. Tamir (arXiv:2108.01368), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/utcsilab/csgm-mri-langevin at commit 91e0a5ac658f (MIT). Any quoted code is shown under that license.