composer.models.deeplabv3.deeplabv3#

composer.models.deeplabv3.deeplabv3

Functions

deeplabv3_builder

Helper function to build a torchvision DeepLabV3 model with a 3x3 convolution layer and dropout removed.

soft_cross_entropy

Drop-in replacement for torch.CrossEntropy that can handle dense labels.

Classes

ASPP

torchvision.models.segmentation.deeplabv3.ASPP

ComposerDeepLabV3

DeepLabV3 model extending the ComposerClassifier.

ComposerModel

The minimal interface needed to use a model with composer.trainer.Trainer.

CrossEntropyLoss

Torchmetric cross entropy loss implementation.

DeepLabV3

Implements DeepLabV3 model from "Rethinking Atrous Convolution for Semantic Image Segmentation".

Initializer

An enumeration.

MIoU

Torchmetric mean Intersection-over-Union (mIoU) implementation.

MetricCollection

MetricCollection class can be used to chain metrics that have the same call pattern into one single class.

Attributes

  • Any

  • BatchPair

  • List

class composer.models.deeplabv3.deeplabv3.ComposerDeepLabV3(num_classes, backbone_arch='resnet101', is_backbone_pretrained=True, sync_bn=True, initializers=[])[source]#

Bases: composer.models.base.ComposerModel

DeepLabV3 model extending the ComposerClassifier.

See arxiv.org/abs/1706.05587 for more details on the DeepLabV3 architecture.

Parameters
  • num_classes (int) โ€“ the number of classes in the segmentation task.

  • backbone_arch (str) โ€“ the backbone architecture to use, either โ€˜resnet50โ€™, โ€˜resnet101โ€™. Default is โ€˜resnet101โ€™.

  • is_backbone_pretrained (bool) โ€“ if true (default), use pre-trained weights for backbone.

  • sync_bn (bool) โ€“ if true (default), use SyncBatchNorm to sync batch norm statistics across GPUs.

loss(outputs, batch)[source]#

Calculate the specified loss for training.

metrics(train=False)[source]#

Metrics to compute during validation.

validate(batch)[source]#

Generate outputs used during validation.

composer.models.deeplabv3.deeplabv3.deeplabv3_builder(num_classes, backbone_arch='resnet101', is_backbone_pretrained=True, sync_bn=True, initializers=[])[source]#

Helper function to build a torchvision DeepLabV3 model with a 3x3 convolution layer and dropout removed.

Parameters
  • num_classes (int) โ€“ number of classes in the segmentation task.

  • backbone_arch (str) โ€“ the architecture to use for the backbone. Must be either [โ€˜resnet50โ€™, โ€˜resnet101โ€™]. Default is โ€˜resnet101โ€™.

  • is_backbone_pretrained (bool) โ€“ if true (default), use pretrained weights for the backbone.

  • sync_bn (bool) โ€“ if true (default), replace all BatchNorm layers with SyncBatchNorm layers.