class
UNet
[source]
UNet
(in_channels
:int
=7
,out_classes
:int
=1
,dimensions
:int
=3
,num_encoding_blocks
:int
=4
,out_channels_first_layer
:int
=10
,normalization
:str
='batch'
,pooling_type
:str
='max'
,upsampling_type
:str
='nearest'
,preactivation
:bool
=False
,residual
:bool
=False
,use_padding
:bool
=True
,padding_mode
:str
='zeros'
,activation
:str
='ReLU'
,classifier_activation
:str
='Sigmoid'
,initial_dilation
:int
=None
,dropout
:float
=0.0
,upsample_recover_orig_size
:bool
=True
,pooling_kernel_size
:Union
[int
,list
]=[3, 3, 3]
,use_classifier
:bool
=True
,verbose
:bool
=True
) ::Module
UNets are convolutional autoencoders that were developed for biomedical image segmentation at the Computer Science Department of the University of Freiburg [1].
The network is based on a fully convolutional network and its architecture was modified and extended to work with fewer training images and to yield more precise segmentations.
Our code based on https://github.com/fepegar/unet/tree/master/unet
.
Type | Default | Details | |
---|---|---|---|
in_channels |
int |
7 |
The number of input channels. |
out_classes |
int |
1 |
The number of output classes. |
dimensions |
int |
3 |
The number of dimensions to consider. Possible options are 2 and 3. |
num_encoding_blocks |
int |
4 |
The number of encoding blocks. |
out_channels_first_layer |
int |
10 |
The number of output channels after the first encoding step. |
normalization |
str |
batch |
The type of normalization to use. Possible options include "batch", "layer" and "instance". |
pooling_type |
str |
max |
The type of pooling to use. |
upsampling_type |
str |
nearest |
The type of upsampling to use. |
preactivation |
bool |
False |
Whether to use preactivations. |
residual |
bool |
False |
Whether the encoder should be a residual network. |
use_padding |
bool |
True |
Whether to use padding. |
padding_mode |
str |
zeros |
The type of padding to use. |
activation |
str |
ReLU |
The activation function that should be used. |
classifier_activation |
str |
Sigmoid |
The activation function for the classifier at the end of the UNet. |
initial_dilation |
int |
None |
The amount of dilation that should be used in the first encoding block. |
dropout |
float |
0.0 |
The dropout rate. |
upsample_recover_orig_size |
bool |
True |
Whether the original input size of the encoder should be recovered with the decoder output. |
pooling_kernel_size |
typing.Union[int, list] |
(3, 3, 3) |
The size of the pooling kernel. |
use_classifier |
bool |
True |
Whether to use a classifier layer at the end of the network. |
verbose |
bool |
True |
Whether to print the user information on the neural network, for instance the number of parameters. |
UNet.forward
[source]
UNet.forward
(model_inputs
:Tensor
)
The forward pass of the UNet. Returns a torch.Tensor
object.
Type | Default | Details | |
---|---|---|---|
model_inputs |
Tensor |
The input to the UNet. |
class
UNet3D
[source]
UNet3D
(*args
, **user_kwargs
) ::UNet
A 3d version of our UNet. UNets are convolutional autoencoders that were developed for biomedical image segmentation at the Computer Science Department of the University of Freiburg [1].
The network is based on a fully convolutional network and its architecture was modified and extended to work with fewer training images and to yield more precise segmentations.
Our code based on https://github.com/fepegar/unet/tree/master/unet
.
[1] Falk, Thorsten, et al. "U-Net: deep learning for cell counting, detection, and morphometry." Nature methods 16.1 (2019): 67-70.