4
4
5
5
6
6
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
+ """
7
25
8
26
def __init__ (
9
27
self ,
10
28
encoder_name = 'resnet34' ,
11
29
encoder_weights = 'imagenet' ,
12
30
decoder_pyramid_channels = 256 ,
13
- decoder_segmenation_channels = 128 ,
31
+ decoder_segmentation_channels = 128 ,
14
32
classes = 1 ,
15
33
dropout = 0.2 ,
16
34
activation = 'sigmoid' ,
17
35
):
18
-
19
36
encoder = get_encoder (
20
37
encoder_name ,
21
38
encoder_weights = encoder_weights
@@ -24,7 +41,7 @@ def __init__(
24
41
decoder = FPNDecoder (
25
42
encoder_channels = encoder .out_shapes ,
26
43
pyramid_channels = decoder_pyramid_channels ,
27
- segmentation_channels = decoder_segmenation_channels ,
44
+ segmentation_channels = decoder_segmentation_channels ,
28
45
final_channels = classes ,
29
46
dropout = dropout ,
30
47
)
0 commit comments