mednet.models.segment.backbones.mobilenetv2

Support code to adapt existing MobileNetV2 pytorch model functionality to U-Net style network for segmentation.

Functions

mobilenet_v2_for_segmentation([pretrained, ...])

Classes

MobileNetV24Segmentation(*args, **kwargs)

Adaptation of MobileNetV2 pytorch model to U-Net style network for segmentation.

class mednet.models.segment.backbones.mobilenetv2.MobileNetV24Segmentation(*args, **kwargs)[source]

Bases: MobileNetV2

Adaptation of MobileNetV2 pytorch model to U-Net style network for segmentation.

This version of MobileNetV2 is slightly modified so it can be used through torchvision’s API. It outputs intermediate features which are normally not output by the base MobileNetV2 implementation, but are required for segmentation operations.

Parameters:
  • *args – Arguments to be passed to the parent MobileNetV2 model.

  • **kwargs

    Keyword arguments to be passed to the parent MobileNetV2 model.

    • return_features (list): An optional list of integers indicating the feature layers to be returned from the original module.

forward(x)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

mednet.models.segment.backbones.mobilenetv2.mobilenet_v2_for_segmentation(pretrained=False, progress=True, **kwargs)[source]