direct.nn.lpd package#
Submodules#
direct.nn.lpd.config module#
- class direct.nn.lpd.config.LPDNetConfig(model_name: str = '???', engine_name: str | None = None, num_iter: int = 25, num_primal: int = 5, num_dual: int = 5, primal_model_architecture: str = 'MWCNN', dual_model_architecture: str = 'DIDN', primal_mwcnn_hidden_channels: int = 16, primal_mwcnn_num_scales: int = 4, primal_mwcnn_bias: bool = True, primal_mwcnn_batchnorm: bool = False, primal_unet_num_filters: int = 8, primal_unet_num_pool_layers: int = 4, primal_unet_dropout_probability: float = 0.0, dual_conv_hidden_channels: int = 16, dual_conv_n_convs: int = 4, dual_conv_batchnorm: bool = False, dual_didn_hidden_channels: int = 64, dual_didn_num_dubs: int = 6, dual_didn_num_convs_recon: int = 9, dual_unet_num_filters: int = 8, dual_unet_num_pool_layers: int = 4, dual_unet_dropout_probability: float = 0.0)[source][source]#
Bases:
ModelConfig
-
dual_conv_batchnorm:
bool
= False#
-
dual_conv_n_convs:
int
= 4#
-
dual_didn_num_convs_recon:
int
= 9#
-
dual_didn_num_dubs:
int
= 6#
-
dual_model_architecture:
str
= 'DIDN'#
-
dual_unet_dropout_probability:
float
= 0.0#
-
dual_unet_num_filters:
int
= 8#
-
dual_unet_num_pool_layers:
int
= 4#
-
num_dual:
int
= 5#
-
num_iter:
int
= 25#
-
num_primal:
int
= 5#
-
primal_model_architecture:
str
= 'MWCNN'#
-
primal_mwcnn_batchnorm:
bool
= False#
-
primal_mwcnn_bias:
bool
= True#
-
primal_mwcnn_num_scales:
int
= 4#
-
primal_unet_dropout_probability:
float
= 0.0#
-
primal_unet_num_filters:
int
= 8#
-
primal_unet_num_pool_layers:
int
= 4#
-
dual_conv_batchnorm:
direct.nn.lpd.lpd module#
- class direct.nn.lpd.lpd.DualNet(num_dual, **kwargs)[source][source]#
Bases:
Module
Dual Network for Learned Primal Dual Network.
- static compute_model_per_coil(model, data)[source][source]#
Computes model per coil.
- Parameters:
- model: nn.Module
Model to compute.
- data: torch.Tensor
Multi-coil input.
- Returns:
- output: torch.Tensor
Multi-coil output.
- Return type:
Tensor
- forward(h, forward_f, g)[source][source]#
Define the computation performed at every call.
Should be overridden by all subclasses. :rtype:
Tensor
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training:
bool
#
- class direct.nn.lpd.lpd.LPDNet(forward_operator, backward_operator, num_iter, num_primal, num_dual, primal_model_architecture='MWCNN', dual_model_architecture='DIDN', **kwargs)[source][source]#
Bases:
Module
Learned Primal Dual network implementation inspired by [1].
References
[1]Adler, Jonas, and Ozan Öktem. “Learned Primal-Dual Reconstruction.” IEEE Transactions on Medical Imaging, vol. 37, no. 6, June 2018, pp. 1322–32. arXiv.org, https://doi.org/10.1109/TMI.2018.2799231.
- forward(masked_kspace, sensitivity_map, sampling_mask)[source][source]#
Computes forward pass of
LPDNet
.- Parameters:
- masked_kspace: torch.Tensor
Masked k-space of shape (N, coil, height, width, complex=2).
- sensitivity_map: torch.Tensor
Sensitivity map of shape (N, coil, height, width, complex=2).
- sampling_mask: torch.Tensor
Sampling mask of shape (N, 1, height, width, 1).
- Returns:
- output: torch.Tensor
Output image of shape (N, height, width, complex=2).
- Return type:
Tensor
-
training:
bool
#
- class direct.nn.lpd.lpd.PrimalNet(num_primal, **kwargs)[source][source]#
Bases:
Module
Primal Network for Learned Primal Dual Network.
- forward(f, backward_h)[source][source]#
Define the computation performed at every call.
Should be overridden by all subclasses. :rtype:
Tensor
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training:
bool
#
direct.nn.lpd.lpd_engine module#
- class direct.nn.lpd.lpd_engine.LPDNetEngine(cfg, model, device, forward_operator=None, backward_operator=None, mixed_precision=False, **models)[source][source]#
Bases:
MRIModelEngine
LPDNet Engine.