BM3D#
- class deepinv.models.BM3D(use_legacy=True, device='cpu', **kwargs)[source]#
Bases:
DenoiserBM3D denoiser.
The BM3D denoiser was introduced by Dabov et al.[1].
- Parameters:
use_legacy (bool) – Whether to use the legacy implementation of BM3D. Default:
Truedevice (torch.device | str) – Device to run the fast implementation of BM3D on. Default:
"cpu"kwargs (dict) – additional keyword arguments for the fast implementation of BM3D. See the note below for details.
Note
Unlike other denoisers from the library, this denoiser is applied sequentially to each noisy image in the batch (no parallelization). Furthermore, it does not support backpropagation.
Note
Additional keyword arguments are supported for the fast implementation of BM3D (when
use_legacy=False), which include:patch_size: size of each image patch. Default: 8search_radius: search window radius for block matching. Default: 19search_step: step size for block matching. Default: 1ref_stride: stride for selecting reference patches. Default: 3chunk_size: number of groups to process in parallel. Default: 2048ht_group_size: group size for stage 1 (hard-thresholding). Default: 16wiener_group_size: group size for stage 2 (Wiener filtering). Default: 32spatial_ht_transform: spatial transform for stage 1. Default:"bior1.5"spatial_wiener_transform: spatial transform for stage 2. Default:"dct"group_ht_transform: group transform for stage 1. Default:"haar"group_wiener_transform: group transform for stage 2. Default:"haar"hard_threshold: hard-thresholding parameter for stage 1. Default: 3.0wiener_mu2: Wiener filtering parameter for stage 2. Default: 0.4
Warning
When
use_legacy=True, the denoiser calls the BM3D denoiser from the BM3D python package. It can be installed withpip install bm3d. This implementation always runs on the CPU regardless of the device of the input tensor.When
use_legacy=False, the denoiser calls a custom re-implementation of BM3D. It requiresptwt, which can be installed withpip install ptwt. It runs on the device specified by thedeviceparameter, and is significantly faster than the legacy implementation, especially when the input tensor is on the GPU. However, it may produce slightly different results than the legacy implementation.
- References: