FC-Siamese Networks#
- class torchgeo.models.FCSiamConc(*args, **kwargs)[source]#
Bases:
SegmentationModelFully-convolutional Siamese Concatenation (FC-Siam-conc).
If you use this model in your research, please cite the following paper:
- __init__(encoder_name='resnet34', encoder_depth=5, encoder_weights='imagenet', decoder_use_batchnorm='batchnorm', decoder_channels=(256, 128, 64, 32, 16), decoder_attention_type=None, in_channels=3, classes=1, activation=None)[source]#
Initialize a new FCSiamConc model.
- Parameters:
encoder_name (str) – Name of the classification model that will be used as an encoder (a.k.a backbone) to extract features of different spatial resolution
encoder_depth (int) – A number of stages used in encoder in range [3, 5]. two times smaller in spatial dimensions than previous one (e.g. for depth 0 we will have features. Each stage generate features with shapes [(N, C, H, W),], for depth 1 - [(N, C, H, W), (N, C, H // 2, W // 2)] and so on). Default is 5
encoder_weights (str | None) – One of None (random initialization), “imagenet” (pre-training on ImageNet) and other pretrained weights (see table with available weights for each encoder_name)
decoder_channels (Sequence[int]) – List of integers which specify in_channels parameter for convolutions used in decoder. Length of the list should be the same as encoder_depth
decoder_use_batchnorm (bool | str | dict[str, Any]) –
Specifies normalization between Conv2D and activation. Accepts the following types:
True: Defaults to “batchnorm”.
False: No normalization (nn.Identity).
str: Specifies normalization type using default parameters. Available values: “batchnorm”, “identity”, “layernorm”, “instancenorm”, “inplace”.
dict: Fully customizable normalization settings. Structure:
`python {"type": <norm_type>, **kwargs} `where norm_name corresponds to normalization type (see above), and kwargs are passed directly to the normalization layer as defined in PyTorch documentation.Example:
`python decoder_use_norm = {'type': 'layernorm', 'eps': 1e-2} `
decoder_attention_type (str | None) – Attention module used in decoder of the model. Available options are None and scse. SCSE paper https://arxiv.org/abs/1808.08127
in_channels (int) – A number of input channels for the model, default is 3 (RGB images)
classes (int) – A number of classes for output mask (or you can think as a number of channels of output mask)
activation (str | Callable[[Tensor], Tensor] | None) – An activation function to apply after the final convolution n layer. Available options are “sigmoid”, “softmax”, “logsoftmax”, “tanh”, “identity”, callable and None. Default is None