hyri.regulariser.den_airi#
Implement the AIRI denoiser regulariser.
This file provides channel-wise AIRI denoising with per-channel network selection driven by heuristic noise and peak-intensity estimates.
Class
Apply AIRI denoisers selected from a shelf of pretrained networks. |
- class hyri.regulariser.den_airi.DenAIRI(shelf_path: str, rand_trans: bool = True, rank_num_ch: int = 1, rank_ch_start: int = 0, device: device = device(type='cpu'), dtype: dtype = torch.float32, verbose: bool = True)#
Bases:
RegulariserApply AIRI denoisers selected from a shelf of pretrained networks.
This class implements the learned regularisation operator used by AIRI. For each local channel \(c\), a pretrained denoiser \(\mathcal{D}_{\sigma_c}\) is selected from a denoiser shelf according to the ratio between the heuristic noise level and the current peak-intensity estimate. The denoised channel is then computed as
\[\hat{\mathbf{x}}_c = \rho_c \, \mathcal{D}_{\sigma_c}(\mathbf{x}_c / \rho_c),\]where \(\rho_c\) is the channel-dependent scaling factor and \(\sigma_c\) is the selected denoiser noise level.
Optional random flips and right-angle rotations are applied before denoising and inverted afterwards as a lightweight self-ensembling step.
- Shape:
Input –
(1, C, H, W)whereCequalsrank_num_chfor the current rank.Output –
(1, C, H, W)with the same shape as the input tensor.
Example
>>> den = DenAIRI( ... shelf_path="airi_denoisers/shelf_airi_oaid.csv", ... rank_num_ch=1, ... ) >>> heu = torch.ones(1, 1, 1, 1) >>> peak = torch.ones(1, 1, 1, 1) >>> den.update(heu, peak) >>> x = torch.zeros(1, 1, 16, 16) >>> y = den(x)
References
Terris, M., Dabbech, A., Tang, C., & Wiaux, Y. (2023). Image reconstruction algorithms in radio interferometry: From handcrafted to learned regularization denoisers. MNRAS, 518(1), 604-622.
Initialise AIRI shelf metadata and runtime state.
- Parameters:
shelf_path (str) – Path to the denoiser shelf CSV.
rand_trans (bool, optional) – Apply random flips/rotations before and after denoising. Default: True.
rank_num_ch (int, optional) – Number of channels handled by this rank. Default: 1.
rank_ch_start (int, optional) – Global start index of local channels. Default: 0.
device (torch.device, optional) – Execution device. Default: torch.device(“cpu”).
dtype (torch.dtype, optional) – Tensor dtype for denoising tensors. Default: torch.float.
verbose (bool, optional) – Enable shelf-selection logs. Default: True.
- Raises:
FileNotFoundError – If the denoiser shelf CSV or network files in the shelf cannot be found.
RuntimeError – If the denoiser shelf CSV contains no usable entries.
- __call__(x: Tensor) Tensor#
Denoise all local channels of an image cube.
- Parameters:
x (torch.Tensor) – Input tensor with shape
(1, C, H, W).- Returns:
Denoised tensor with the same shape as
x.- Return type:
Note
The method
update()must be called with valid heuristic noise level and peak-intensity estimates before this method is used, so that the appropriate denoisers are selected and loaded for each channel.
- _den_ch_single(net_input: Tensor, ch: int) Tensor#
Denoise one local channel using the selected shelf network.
- Parameters:
net_input (torch.Tensor) – Local image cube for this rank.
ch (int) – Local channel index to denoise.
- Returns:
Denoised tensor for channel
chwith shape(1, 1, H, W).- Return type:
- update(ch_heuristic: Tensor, ch_peak_est: Tensor) tuple[Tensor, Tensor] | None#
Update per-channel network selection and scaling factors.
- Parameters:
ch_heuristic (torch.Tensor) – Per-channel heuristic noise levels with one value per local channel.
ch_peak_est (torch.Tensor) – Per-channel peak-intensity estimates with one value per local channel.
- Returns:
Lower and upper admissible peak ranges for each local channel, each with shape
(1, C, 1, 1). ReturnsNonewhench_heuristicorch_peak_estisNone.- Return type:
Tuple[torch.Tensor, torch.Tensor]
Note
The selected network for each channel is refreshed only when the admissible shelf sigma changes.