Learning to Refocus Real Noisy Video from Its Own Focus Changes

A wide-aperture camera collects plenty of light, but it keeps only a thin slice of the scene sharp. Everything in front of or behind that slice is blurred, and the blur grows with distance from the plane of focus. Most networks that remove this "defocus blur" from video are trained on clean synthetic clips: sharp footage that has been blurred with a depth-dependent kernel. They then fail on real phone or microscope footage, where every frame also carries sensor noise whose statistics the simulator did not reproduce. They also flicker from frame to frame. We propose to train video defocus deblurring directly on real, noisy, unlabeled footage by using a signal such footage often contains for free. When focus moves during a clip, through an autofocus hunt, a focus pull, or a microscope focus sweep, the same surface appears with different amounts of blur in neighboring frames. The sensor noise in those frames, however, is independent.

The core idea fits in two sentences. A network reads a short block of frames and predicts sharp frames plus a depth map. A thin-lens model then re-blurs that prediction to match each other noisy frame in the block, at that frame's own focus setting. Because the focus settings differ, the network cannot satisfy every frame by passing blur through. Because the noise differs, matching noisy frames costs nothing on average (the Noise2Noise argument). The network therefore learns to deblur and denoise real data without a clean target and without a hand-built noise model. We build the network from 3D convolutions, meaning filters that slide over height, width, and time together. Optical flow, the usual way video models align neighboring frames, is known to break when frames differ in blur, and 3D convolutions remove the need for it.

Core Claim

Our central claim concerns supervision, not architecture. Self-supervised re-blur consistency across frames with different focus states, computed against noisy observations, closes more of the synthetic-to-real gap for video defocus deblurring than any amount of better noise simulation. When this training runs inside a 3D-convolutional encoder-decoder, the output is also more temporally stable than flow-warped alternatives. The claim is falsifiable on one comparison. Take a strong video deblurrer trained on synthetic data with calibrated Poisson-Gaussian noise, which models photon noise plus read noise. On real focus-sweep footage with ground truth, it should lose to the same model fine-tuned with our objective. If it does not, the idea fails.

The claim applies only to footage whose focus changes within a short window. Clips with fixed focus give the objective nothing to work with, and we treat them as a stated limit of the method, not something to argue around.

Where This Sits

Three lines of prior work motivate the gap.

DaBiT is the closest system. It is a depth- and blur-map-guided transformer for video focal deblurring. It found that flow computed between frames with different defocus is corrupted, and it added a recurrent module to repair the flow before warping features. DaBiT trains only on synthetic Gaussian-kernel blur without sensor noise, and reports only qualitative results on the noisy low-light set BVI-RLV. We keep its problem and its benchmark. We replace its supervision with real self-supervision and drop flow entirely.

Video Depth-From-Defocus is our conceptual ancestor. It recovers depth and all-in-focus video from focus ramps of roughly 30 frames through per-clip optimization:

  • PatchMatch alignment;
  • a regularized depth cost volume;
  • non-blind deconvolution with a natural-image prior.

That prior is fragile under noise. It also refines a per-frame focus distance, which we borrow. We amortize the same physics into a feedforward network trained across many clips, and we replace the hand-built prior with a noise-unbiased loss.

Joint Deblurring and 3D Reconstruction for Macrophotography supplies the re-blur-and-compare technique. It renders sharp Gaussian splats, blurs them with predicted depth-dependent kernels, and matches blurry captures. It is limited to static multi-view scenes with offline camera poses, and it reports that large per-pixel kernels are costly in memory. We apply the same principle to video. To avoid that kernel cost, we render blur over a small set of depth layers, in the spirit of the focal-plane-adapted layered images of Any-to-Bokeh. Any-to-Bokeh itself only adds blur in the forward direction. It is relevant here mainly for two findings: corrupted inputs must be seen in training, and windowed inference leaves visible seams.

Two papers constrain the design.

Seeing Through the PRISM restores single scientific images with compound noise and blur. It shows that models trained on idealized synthetic noise degrade on real sensor distortions. It also shows that aggressive denoising can lower downstream utility: on BioSR, selective restoration gave the best cell-segmentation mIoU of 0.580. So we evaluate downstream utility as well as PSNR.

Deep End2End Voxel2Voxel Prediction supplies the architecture. It is a 3D-convolutional encoder-decoder for dense video prediction that is temporally consistent without flow. It also warns that action-recognition pretraining destroys the fine detail that low-level tasks need, so we train from scratch. Its memory limit of about 16 frames is acceptable here, because our objective only needs short windows.

Research Program

Inputs and outputs. The model reads a window of $T$ noisy frames $I_1,\dots,I_T$, with $T$ between 8 and 16. It outputs, for each frame $t$:

  • a sharp frame $S_t$;
  • an inverse-depth map $Z_t$;
  • one scalar per frame, $\phi_t$, for the inverse focus distance.

Under the thin-lens model, the blur diameter at a pixel is approximately $c = \kappa\,|Z_t - \phi_{t'}|$, where $\kappa$ is a per-camera constant set by aperture and focal length. This follows from the circle-of-confusion formula when the object is much farther away than the focal length.

Rendering blur. Let $R(S, Z, \phi)$ denote layered rendering. It splits $S$ into $L$ inverse-depth bins, blurs each bin with a disc of diameter $\kappa|z_\ell-\phi|$ using FFT convolution, and composites the bins front to back.

Training objective. The real-data loss is a temporal blind-spot re-blur loss:

$$\mathcal{L} = \sum_{t}\sum_{t'\neq t} w_{tt'} \,\big\| R(S_t, Z_t, \phi_{t'}) - I_{t'} \big\|_1 .$$

Here $S_t, Z_t$ are predicted from the window with frame $t'$ masked out of the input. The weight $w_{tt'}$ decays with $|t-t'|$ and down-weights pixels with large residuals, which absorbs object motion within the short window.

Three properties make this objective informative:

  • No copying. Masking $I_{t'}$ prevents the network from copying the frame it is scored against.
  • No blur pass-through. A single $(S_t, Z_t)$ must explain several frames whose $\phi_{t'}$ differ. The blur-preserving shortcut ($S_t$ equal to a blurry frame, zero blur) is therefore inconsistent with at least some of them.
  • Noise cancels on average. The noise in $I_{t'}$ is zero-mean and independent of the input. In expectation it adds only a constant to an L2 version of the loss, so the minimizer is the clean signal. We use L1 for robustness and check empirically that the L2 variant agrees.

An optional DPDD-style sharpness prior is not used. We want the gains attributable to the physics alone.

Training stages. Training has two stages:

  1. Synthetic pretraining on DAVIS-Blur-style data, with Poisson-Gaussian noise and supervised targets.
  2. Self-supervised fine-tuning on unlabeled real clips with focus changes. These include smartphone autofocus-hunt footage we record, and existing microscopy focus sweeps such as the multifocal diatom sequences of UDE DIATOMS in the Wild 2024.

Backbone. The network is a V2V-style 3D U-Net with $3\times3\times3$ kernels, following C3D. Its heads output $S$, $Z$, and $\phi$.

Long videos. Long videos are processed in overlapping windows with cosine blending. Seams at window boundaries are measured explicitly, not assumed away.

Benchmarks and Data

Synthetic. We use DAVIS-Blur from DaBiT with its protocol. We add noisy variants at several gain levels, sampled from Poisson-Gaussian parameters estimated from our test cameras.

Real with ground truth. We need a benchmark that does not yet exist, and we will build it following the protocol of Defocus Deblurring Using Dual-Pixel Data. For each of roughly 100 static tabletop and macro scenes we record:

  • a wide-aperture video during which focus is swept or hunts;
  • an $f/22$ long-exposure capture of the same scene, which serves as the sharp, low-noise reference.

Scene and camera stay fixed, which makes per-frame ground truth valid. We also record matched low-light versions at high gain. A separate split with slow object motion is evaluated only by no-reference and temporal metrics.

Real without ground truth. For BVI-RLV and the diatom sequences we report temporal stability and a downstream task: diatom segmentation or classification with a fixed pretrained model.

Metrics

We report:

  • PSNR and SSIM against the $f/22$ reference;
  • LPIPS;
  • tOF, the temporal optical-flow error used by DaBiT;
  • warping error at window seams;
  • downstream accuracy on the diatom data.

Baselines

Naive reference points. The do-nothing reference is the noisy input video itself. The naive learned reference is per-frame Restormer fine-tuned for defocus deblurring and run independently on each frame. On DPDD, Quad-Pixel Image Defocus Deblurring reports Restormer at 26.66 dB PSNR and LMNet at 27.25 dB. That comparison uses dual-pixel inputs our videos lack, so we use the single-input variant and expect it to sit below those figures. This reference tells us how much flicker per-frame processing produces and how far plain spatial deblurring gets on our real set.

Strongest existing method. The strongest competitor is DaBiT. It is the only learned system in the file built for video focal deblurring, and it explicitly targets the flow-under-defocus failure. Its paper reports an average gain of 1.9 dB PSNR and 0.09 SSIM over competing baselines, and a tOF reduction of at least 1.05 against the next best model on DAVIS-Blur. The file gives no absolute DaBiT PSNR (no reported result found on Lacuna for DaBiT's absolute DAVIS-Blur PSNR), so we will reproduce it from the released recipe.

To make DaBiT as strong as possible, we retrain it on exactly our synthetic data, including the same calibrated Poisson-Gaussian noise. It gets the same GPU budget and the same hyperparameter-search budget as our model. Beating it means two things on the real $f/22$-referenced set: higher PSNR by more than the seed-to-seed spread, and lower tOF. Matching DaBiT on synthetic DAVIS-Blur suffices there, since synthetic data is not where we claim an advantage.

Classical baseline. We include the classical Video Depth-From-Defocus pipeline on our focus-sweep clips. No reported result found on Lacuna for it on any shared benchmark. It is the natural test of whether amortized learning adds anything over per-clip physics.

Ablations isolating the key ingredient. Four ablations each remove one piece:

  1. Self-supervision. Our 3D network trained only on synthetic data with calibrated noise, same budget. This isolates the real self-supervised fine-tuning.
  2. Architecture. Our objective attached to a flow-warping recurrent backbone, specifically DaBiT's propagation trunk. This isolates the 3D convolutions.
  3. Masking. The blind-spot mask removed, which should collapse toward identity or blurred outputs.
  4. Focus variation. Fine-tuning on clips with constant focus, which should yield no gain.

Why not just…?

Why not just train DaBiT, or any video deblurrer, with a better noise simulator? This is the real threat, because the gap in the literature may be mostly about noise realism. PRISM's finding that idealized synthetic noise fails on real sensors argues against it, but PRISM concerns single images and generic simulators. We will give the simulator its best case: noise parameters calibrated on the very cameras used for testing. Ablation 1 above, with DaBiT under the same treatment, then answers the question directly. If calibrated simulation matches self-supervised fine-tuning on the real set, we will report that the cheap route suffices. Our contribution then shrinks to the architecture and stability results.

Why not just run a strong single-image deblurrer per frame and smooth the result over time? Per-frame models throw away the strongest cue available: neighboring frames show the same surface with a different blur and independent noise. Temporal smoothing applied afterward cannot recover detail that no single frame contains. It also either lags behind motion or leaves the flicker in place. V2V's segmentation result supports processing frames jointly: 76.0% versus 55.7% for a 2D per-frame network. That evidence comes from a different task, so the Restormer baseline with and without a temporal filter will measure the effect here directly.

Why not just denoise first with a self-supervised video denoiser, then deblur? A cascade separates two problems that interact. Denoising before deconvolution smooths away exactly the faint high-frequency content that deconvolution needs. PRISM's microscopy result shows aggressive denoising hurting downstream segmentation. The cascade also gains nothing from focus diversity. We include it as a baseline, using a Noise2Noise-style temporal denoiser followed by our synthetic-trained deblurrer. If it matches the joint model, the joint re-blur loss is not earning its keep.

Decisive Checks

The experiment that decides the proposal compares, on the real $f/22$-referenced focus-sweep set at high gain:

  • self-supervised fine-tuning of our model;
  • the same model trained only on synthetic data with calibrated noise;
  • DaBiT trained the same way.

Real self-supervision must win on PSNR and on tOF. A second check verifies the mechanism. The gain from fine-tuning should grow with how much focus changes within the window, and it should vanish on constant-focus clips. If gains appear even without focus change, they come from something other than re-blur consistency, and we would have to explain them. A third check tests utility on the diatom sequences. The restored output must not lower downstream accuracy relative to the raw sharpest frame, which guards against the aesthetics-over-utility failure PRISM documents. Finally, swapping the 3D backbone for the flow-warping one under the same objective tells us whether the architectural half of the claim survives. If it does not, we will present the method as an objective that works with any backbone.