
smp_FPN_mit_b1
Segmentation432 ops15M params
SMP's FPN segmentation decoder on SegFormer's MiT-B0 encoder, random weights, 21 classes at 256 px.
Segmentation · 432 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
How this diagram was made
segmentation_models_pytorch.FPN(encoder_name='mit_b0', encoder_weights=None, in_channels=3, classes=21)
This member pairs two papers' ideas: the Feature Pyramid Network of Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan and Serge Belongie as the decoder, and SegFormer's Mix Transformer as the encoder, assembled by the Segmentation Models Pytorch (SMP for short) library. SMP offers 12 encoder-decoder model architectures (Unet, Unet++, Segformer, DPT, ...) and 800+ pretrained convolution- and transform-based encoders, so a pyramid decoder on a transformer backbone is one combination among hundreds. The result is a semantic segmenter that takes a single-scale image of an arbitrary size as input, and outputs proportionally sized feature maps, here decoded into a per-pixel class map.
FPN's insight is to exploit the inherent multi-scale, pyramidal hierarchy of deep convolutional networks to construct feature pyramids with marginal extra cost. Its top-down pathway hallucinates higher resolution features by upsampling spatially coarser, but semantically stronger, feature maps from higher pyramid levels, and each upsampled map is merged with the corresponding bottom-up map (which undergoes a 1×1 convolutional layer to reduce channel dimensions) by element-wise addition. The paper fixes the feature dimension at d = 256 in every pyramid level and appends a 3×3 convolution on each merged map to reduce aliasing. The original paper already generalized FPNs to instance segmentation proposals, so a dense segmentation head on the pyramid follows the authors' own direction.
The encoder here is MiT-B0, the smallest of the Mix Transformer encoders (MiT), MiT-B0 to MiT-B5, with the same architecture but different sizes, which SegFormer's authors Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez and Ping Luo describe as their lightweight model for fast inference. It is a hierarchically structured Transformer encoder which outputs multiscale features and does not need positional encoding, thereby avoiding the interpolation of positional codes which leads to decreased performance when the testing resolution differs from training. Position comes instead from Mix-FFN, which considers the effect of zero padding to leak location information by directly using a 3 × 3 Conv in the feed-forward network (FFN), and the encoder yields multi-level features at {1/4, 1/8, 1/16, 1/32} of the original image resolution, the four scales the FPN decoder consumes. The member is built with random weights and 21 output classes, which SMP supports through its classes argument, the model output channels (number of classes in your dataset).
Key idea. A top-down pathway with lateral connections that turns a backbone's multi-scale hierarchy into 256-channel semantic maps at every level, here fed by a positional-encoding-free Mix Transformer encoder.
AI-written summary, checked automatically against its sources; not reviewed by a person. Corrections welcome.
@misc{lin2017featurepyramidnetworksobject,
title={Feature Pyramid Networks for Object Detection},
author={Tsung-Yi Lin and Piotr Dollár and Ross Girshick and Kaiming He and Bharath Hariharan and Serge Belongie},
year={2017},
eprint={1612.03144},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/1612.03144},
}