UNetR3DDecoder#
- pydantic model vision_architectures.nets.unetr_3d_decoder.UNetR3DDecoderConfig[source]#
Bases:
CustomBaseModelShow JSON schema
{ "title": "UNetR3DDecoderConfig", "type": "object", "properties": { "num_outputs": { "description": "The number of output channels", "title": "Num Outputs", "type": "integer" }, "conv_kernel_size": { "anyOf": [ { "type": "integer" }, { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" } ], "description": "The kernel size of the convolution layers", "title": "Conv Kernel Size" }, "final_layer_kernel_size": { "anyOf": [ { "type": "integer" }, { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" } ], "description": "The kernel size of the final layer", "title": "Final Layer Kernel Size" } }, "required": [ "num_outputs", "conv_kernel_size", "final_layer_kernel_size" ] }
- Config:
arbitrary_types_allowed: bool = True
extra: str = ignore
validate_default: bool = True
validate_assignment: bool = True
validate_return: bool = True
- Fields:
- Validators:
-
field num_outputs:
int[Required]# The number of output channels
- Validated by:
-
field conv_kernel_size:
int|tuple[int,int,int] [Required]# The kernel size of the convolution layers
- Validated by:
-
field final_layer_kernel_size:
int|tuple[int,int,int] [Required]# The kernel size of the final layer
- Validated by:
- pydantic model vision_architectures.nets.unetr_3d_decoder.UNetR3DStageConfig[source]#
Bases:
CustomBaseModelShow JSON schema
{ "title": "UNetR3DStageConfig", "type": "object", "properties": { "in_dim": { "description": "The number of input channels", "title": "In Dim", "type": "integer" }, "out_dim": { "description": "The number of output channels", "title": "Out Dim", "type": "integer" }, "in_patch_size": { "description": "The patch size of the input", "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "title": "In Patch Size", "type": "array" }, "out_patch_size": { "description": "The patch size of the output", "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "title": "Out Patch Size", "type": "array" } }, "required": [ "in_dim", "out_dim", "in_patch_size", "out_patch_size" ] }
- Config:
arbitrary_types_allowed: bool = True
extra: str = ignore
validate_default: bool = True
validate_assignment: bool = True
validate_return: bool = True
- Fields:
- Validators:
-
field in_dim:
int[Required]# The number of input channels
- Validated by:
-
field out_dim:
int[Required]# The number of output channels
- Validated by:
-
field in_patch_size:
tuple[int,int,int] [Required]# The patch size of the input
- Validated by:
-
field out_patch_size:
tuple[int,int,int] [Required]# The patch size of the output
- Validated by:
- pydantic model vision_architectures.nets.unetr_3d_decoder.UNetR3DConfig[source]#
Bases:
CustomBaseModelShow JSON schema
{ "title": "UNetR3DConfig", "type": "object", "properties": { "in_channels": { "description": "The number of input channels", "title": "In Channels", "type": "integer" }, "decoder": { "$ref": "#/$defs/UNetR3DDecoderConfig", "description": "The decoder configuration" }, "stages": { "description": "The stage configurations", "items": { "$ref": "#/$defs/UNetR3DStageConfig" }, "title": "Stages", "type": "array" } }, "$defs": { "UNetR3DDecoderConfig": { "properties": { "num_outputs": { "description": "The number of output channels", "title": "Num Outputs", "type": "integer" }, "conv_kernel_size": { "anyOf": [ { "type": "integer" }, { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" } ], "description": "The kernel size of the convolution layers", "title": "Conv Kernel Size" }, "final_layer_kernel_size": { "anyOf": [ { "type": "integer" }, { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" } ], "description": "The kernel size of the final layer", "title": "Final Layer Kernel Size" } }, "required": [ "num_outputs", "conv_kernel_size", "final_layer_kernel_size" ], "title": "UNetR3DDecoderConfig", "type": "object" }, "UNetR3DStageConfig": { "properties": { "in_dim": { "description": "The number of input channels", "title": "In Dim", "type": "integer" }, "out_dim": { "description": "The number of output channels", "title": "Out Dim", "type": "integer" }, "in_patch_size": { "description": "The patch size of the input", "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "title": "In Patch Size", "type": "array" }, "out_patch_size": { "description": "The patch size of the output", "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "title": "Out Patch Size", "type": "array" } }, "required": [ "in_dim", "out_dim", "in_patch_size", "out_patch_size" ], "title": "UNetR3DStageConfig", "type": "object" } }, "required": [ "in_channels", "decoder", "stages" ] }
- Config:
arbitrary_types_allowed: bool = True
extra: str = ignore
validate_default: bool = True
validate_assignment: bool = True
validate_return: bool = True
- Fields:
- Validators:
validate»all fields
-
field in_channels:
int[Required]# The number of input channels
- Validated by:
-
field decoder:
UNetR3DDecoderConfig[Required]# The decoder configuration
- Validated by:
-
field stages:
list[UNetR3DStageConfig] [Required]# The stage configurations
- Validated by:
- class vision_architectures.nets.unetr_3d_decoder.UNetR3DDecoder(config={}, checkpointing_level=0, **kwargs)[source]#
Bases:
Module,PyTorchModelHubMixinUNetR3DDecoder made using multiple conv and deconv blocks.
- __init__(config={}, checkpointing_level=0, **kwargs)[source]#
Initialize the UNetR3DDecoder.
- Parameters:
config (
UNetR3DConfig) – An instance of the Config class that contains all the configuration parameters. It can also be passed as a dictionary and the instance will be created automatically.checkpointing_level (
int) – The level of checkpointing to use for activation checkpointing. Refer toActivationCheckpointingfor more details.**kwargs – Additional keyword arguments for configuration.
- forward(embeddings, scan)[source]#
Process the multi-scale input embeddings and scan datapoint.
- Parameters:
embeddings – Tensor of shape (B, C, Z, Y, X) or (B, Z, Y, X, C) representing the input features.
scan – Tensor of shape (B, C, Z, Y, X) or (B, Z, Y, X, C) representing the input features.
- Return type:
Tensor- Returns:
Tensor of shape (B, C, Z, Y, X) or (B, Z, Y, X, C) representing the output features.
- static soft_dice_loss_fn(prediction, target, reduction='mean', ignore_index=-100, smooth=1e-05)[source]#
Both prediction and target should be of the form (batch_size, num_classes, depth, width, height).
prediction: probability scores for each class target: should be binary masks.
- static cross_entropy_loss_fn(prediction, target, reduction='mean', ignore_index=-100, smooth=1e-05)[source]#
Both prediction and target should be of the form (batch_size, num_classes, depth, width, height).
prediction: probability scores for each class target: should be binary masks.
- static loss_fn(prediction, target, reduction='mean', weight_dsc=1.0, weight_ce=1.0, ignore_index=-100, smooth=1e-05, return_components=False)[source]#
Both prediction and target should be of the form (batch_size, num_classes, depth, width, height).
prediction: probability scores for each class target: should be binary masks.