napari_cellseg3d.code_models.models.unet.model
Classes:
| Name | Description |
|---|---|
Abstract3DUNet |
Base class for standard and residual UNet. |
UNet3D |
3DUnet model from |
Abstract3DUNet
Bases: Module
Base class for standard and residual UNet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_channels
|
int
|
number of input channels |
required |
out_channels
|
int
|
number of output segmentation masks; Note that that the of out_channels might correspond to either different semantic classes or to different binary segmentation mask. It's up to the user of the class to interpret the out_channels and use the proper loss criterion during training (i.e. CrossEntropyLoss (multi-class) or BCEWithLogitsLoss (two-class) respectively) |
required |
f_maps
|
(int, tuple)
|
number of feature maps at each level of the encoder; if it's an integer the number of feature maps is given by the geometric progression: f_maps ^ k, k=1,2,3,4 |
64
|
final_sigmoid
|
bool
|
if True apply element-wise nn.Sigmoid after the final 1x1 convolution, otherwise apply nn.Softmax. MUST be True if nn.BCELoss (two-class) is used to train the model. MUST be False if nn.CrossEntropyLoss (multi-class) is used to train the model. |
required |
basic_module
|
basic model for the encoder/decoder (DoubleConv, ExtResNetBlock, ....) |
required | |
layer_order
|
string
|
determines the order of layers
in |
'gcr'
|
num_groups
|
int
|
number of groups for the GroupNorm |
8
|
num_levels
|
int
|
number of levels in the encoder/decoder path (applied only if f_maps is an int) |
4
|
is_segmentation
|
bool
|
if True (semantic segmentation problem) Sigmoid/Softmax normalization is applied after the final convolution; if False (regression problem) the normalization layer is skipped at the end |
True
|
conv_kernel_size
|
int or tuple
|
size of the convolving kernel in the basic_module |
3
|
pool_kernel_size
|
int or tuple
|
the size of the window |
2
|
conv_padding
|
int or tuple
|
add zero-padding added to all three sides of the input |
1
|
Source code in napari_cellseg3d/code_models/models/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 120 121 122 123 124 125 126 127 128 129 130 | |
UNet3D
Bases: Abstract3DUNet
3DUnet model from
"3D U-Net: Learning Dense Volumetric Segmentation from Sparse Annotation"
<https://arxiv.org/pdf/1606.06650.pdf>.
Uses DoubleConv as a basic_module and nearest neighbor upsampling in the decoder
Source code in napari_cellseg3d/code_models/models/unet/model.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |