unet_model
UNet Pydantic model.
UNetModel
#
Bases: ArchitectureModel
Pydantic model for a N2V(2)-compatible UNet.
Attributes:
Name | Type | Description |
---|---|---|
depth | int | Depth of the model, between 1 and 10 (default 2). |
num_channels_init | int | Number of filters of the first level of the network, should be even and minimum 8 (default 96). |
Source code in src/careamics/config/architectures/unet_model.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
architecture
instance-attribute
#
Name of the architecture.
conv_dims = Field(default=2, validate_default=True)
class-attribute
instance-attribute
#
Dimensions (2D or 3D) of the convolutional layers.
depth = Field(default=2, ge=1, le=10, validate_default=True)
class-attribute
instance-attribute
#
Number of levels in the UNet.
final_activation = Field(default='None', validate_default=True)
class-attribute
instance-attribute
#
Final activation function.
in_channels = Field(default=1, ge=1, validate_default=True)
class-attribute
instance-attribute
#
Number of channels in the input to the model.
independent_channels = Field(default=True, validate_default=True)
class-attribute
instance-attribute
#
Whether information is processed independently in each channel, used to train channels independently.
n2v2 = Field(default=False, validate_default=True)
class-attribute
instance-attribute
#
Whether to use N2V2 architecture modifications, with blur pool layers and fewer skip connections.
num_channels_init = Field(default=32, ge=8, le=1024, validate_default=True)
class-attribute
instance-attribute
#
Number of convolutional filters in the first layer of the UNet.
num_classes = Field(default=1, ge=1, validate_default=True)
class-attribute
instance-attribute
#
Number of classes or channels in the model output.
is_3D()
#
Return whether the model is 3D or not.
Returns:
Type | Description |
---|---|
bool | Whether the model is 3D or not. |
set_3D(is_3D)
#
Set 3D model by setting the conv_dims
parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_3D | bool | Whether the algorithm is 3D or not. | required |
Source code in src/careamics/config/architectures/unet_model.py
validate_num_channels_init(num_channels_init)
classmethod
#
Validate that num_channels_init is even.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_channels_init | int | Number of channels. | required |
Returns:
Type | Description |
---|---|
int | Validated number of channels. |
Raises:
Type | Description |
---|---|
ValueError | If the number of channels is odd. |