Skip to content

Commit 569c238

Browse files
committed
Updated docstrings, FPN docstring
1 parent f545747 commit 569c238

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

segmentation_models_pytorch/fpn/model.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,35 @@
44

55

66
class FPN(EncoderDecoder):
7+
"""FPN_ is a fully convolution neural network for image semantic segmentation
8+
Args:
9+
encoder_name: name of classification model (without last dense layers) used as feature
10+
extractor to build segmentation model.
11+
encoder_weights: one of ``None`` (random initialization), ``imagenet`` (pre-training on ImageNet).
12+
decoder_pyramid_channels: a number of convolution filters in Feature Pyramid of FPN_.
13+
decoder_segmentation_channels: a number of convolution filters in segmentation head of FPN_.
14+
classes: a number of classes for output (output shape - ``(batch, classes, h, w)``).
15+
dropout: spatial dropout rate in range (0, 1).
16+
activation: one of [``sigmoid``, ``softmax``, None]
17+
18+
Returns:
19+
``keras.models.Model``: **FPN**
20+
21+
.. _FPN:
22+
http://presentations.cocodataset.org/COCO17-Stuff-FAIR.pdf
23+
24+
"""
725

826
def __init__(
927
self,
1028
encoder_name='resnet34',
1129
encoder_weights='imagenet',
1230
decoder_pyramid_channels=256,
13-
decoder_segmenation_channels=128,
31+
decoder_segmentation_channels=128,
1432
classes=1,
1533
dropout=0.2,
1634
activation='sigmoid',
1735
):
18-
1936
encoder = get_encoder(
2037
encoder_name,
2138
encoder_weights=encoder_weights
@@ -24,7 +41,7 @@ def __init__(
2441
decoder = FPNDecoder(
2542
encoder_channels=encoder.out_shapes,
2643
pyramid_channels=decoder_pyramid_channels,
27-
segmentation_channels=decoder_segmenation_channels,
44+
segmentation_channels=decoder_segmentation_channels,
2845
final_channels=classes,
2946
dropout=dropout,
3047
)

segmentation_models_pytorch/linknet/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Linknet(EncoderDecoder):
1515
encoder_weights: one of ``None`` (random initialization), ``imagenet`` (pre-training on ImageNet).
1616
decoder_use_batchnorm: if ``True``, ``BatchNormalisation`` layer between ``Conv2D`` and ``Activation`` layers
1717
is used.
18-
classes: a number of classes for output (output shape - ``(h, w, classes)``).
18+
classes: a number of classes for output (output shape - ``(batch, classes, h, w)``).
1919
activation: one of [``sigmoid``, ``softmax``, None]
2020
2121
Returns:

segmentation_models_pytorch/unet/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Unet(EncoderDecoder):
1313
decoder_channels: list of numbers of ``Conv2D`` layer filters in decoder blocks
1414
decoder_use_batchnorm: if ``True``, ``BatchNormalisation`` layer between ``Conv2D`` and ``Activation`` layers
1515
is used.
16-
classes: a number of classes for output (output shape - ``(h, w, classes)``).
16+
classes: a number of classes for output (output shape - ``(batch, classes, h, w)``).
1717
activation: one of [``sigmoid``, ``softmax``, None]
1818
center: if ``True`` add ``Conv2dReLU`` block on encoder head (useful for VGG models)
1919

0 commit comments

Comments
 (0)