UNetR3DDecoder#
- pydantic model vision_architectures.nets.unetr_3d_decoder.UNetR3DDecoderConfig[source]#
Bases:
CustomBaseModel
Show JSON schema
{ "title": "UNetR3DDecoderConfig", "type": "object", "properties": { "num_outputs": { "title": "Num Outputs", "type": "integer" }, "conv_kernel_size": { "anyOf": [ { "type": "integer" }, { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" } ], "title": "Conv Kernel Size" }, "final_layer_kernel_size": { "anyOf": [ { "type": "integer" }, { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" } ], "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]# - Validated by:
-
field conv_kernel_size:
int
|tuple
[int
,int
,int
] [Required]# - Validated by:
-
field final_layer_kernel_size:
int
|tuple
[int
,int
,int
] [Required]# - Validated by:
- pydantic model vision_architectures.nets.unetr_3d_decoder.UNetR3DStageConfig[source]#
Bases:
CustomBaseModel
Show JSON schema
{ "title": "UNetR3DStageConfig", "type": "object", "properties": { "in_dim": { "title": "In Dim", "type": "integer" }, "out_dim": { "title": "Out Dim", "type": "integer" }, "in_patch_size": { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "title": "In Patch Size", "type": "array" }, "out_patch_size": { "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]# - Validated by:
-
field out_dim:
int
[Required]# - Validated by:
-
field in_patch_size:
tuple
[int
,int
,int
] [Required]# - Validated by:
-
field out_patch_size:
tuple
[int
,int
,int
] [Required]# - Validated by:
- pydantic model vision_architectures.nets.unetr_3d_decoder.UNetR3DConfig[source]#
Bases:
CustomBaseModel
Show JSON schema
{ "title": "UNetR3DConfig", "type": "object", "properties": { "in_channels": { "title": "In Channels", "type": "integer" }, "decoder": { "$ref": "#/$defs/UNetR3DDecoderConfig" }, "stages": { "items": { "$ref": "#/$defs/UNetR3DStageConfig" }, "title": "Stages", "type": "array" } }, "$defs": { "UNetR3DDecoderConfig": { "properties": { "num_outputs": { "title": "Num Outputs", "type": "integer" }, "conv_kernel_size": { "anyOf": [ { "type": "integer" }, { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" } ], "title": "Conv Kernel Size" }, "final_layer_kernel_size": { "anyOf": [ { "type": "integer" }, { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" } ], "title": "Final Layer Kernel Size" } }, "required": [ "num_outputs", "conv_kernel_size", "final_layer_kernel_size" ], "title": "UNetR3DDecoderConfig", "type": "object" }, "UNetR3DStageConfig": { "properties": { "in_dim": { "title": "In Dim", "type": "integer" }, "out_dim": { "title": "Out Dim", "type": "integer" }, "in_patch_size": { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "title": "In Patch Size", "type": "array" }, "out_patch_size": { "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]# - Validated by:
-
field decoder:
UNetR3DDecoderConfig
[Required]# - Validated by:
-
field stages:
list
[UNetR3DStageConfig
] [Required]# - Validated by:
- class vision_architectures.nets.unetr_3d_decoder.UNetR3DConvBlock(dim, kernel_size)[source]#
Bases:
Module
- __init__(dim, kernel_size)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
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.
- class vision_architectures.nets.unetr_3d_decoder.UNetR3DDeConvBlock(in_dim, out_dim, kernel_size)[source]#
Bases:
Module
- __init__(in_dim, out_dim, kernel_size)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
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.
- class vision_architectures.nets.unetr_3d_decoder.UNetR3DBlock(in_dim, out_dim, conv_kernel_size, deconv_kernel_size, is_first_layer)[source]#
Bases:
Module
- __init__(in_dim, out_dim, conv_kernel_size, deconv_kernel_size, is_first_layer)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(current_layer, previous_layer=None)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
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.
- class vision_architectures.nets.unetr_3d_decoder.UNetR3DDecoder(config)[source]#
Bases:
Module
,PyTorchModelHubMixin
- __init__(config)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(embeddings, scan)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
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.
- static soft_dice_loss_fn(prediction, target, reduction='mean', ignore_index=-100, smooth=1e-08)[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-08)[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-08, 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.