FarSeg#

class torchgeo.models.FarSeg(backbone='resnet50', classes=16, backbone_pretrained=True)[source]#

Bases: Module

Foreground-Aware Relation Network (FarSeg).

This model can be used for binary- or multi-class object segmentation, such as building, road, ship, and airplane segmentation. It can be also extended as a change detection model. It features a foreground-scene relation module to model the relation between scene embedding, object context, and object feature, thus improving the discrimination of object feature representation.

If you use this model in your research, please cite the following paper:

__init__(backbone='resnet50', classes=16, backbone_pretrained=True)[source]#

Initialize a new FarSeg model.

Parameters:
  • backbone (str) – name of ResNet backbone, one of [“resnet18”, “resnet34”, “resnet50”, “resnet101”]

  • classes (int) – number of output segmentation classes

  • backbone_pretrained (bool) – whether to use pretrained weight for backbone

forward(x)[source]#

Forward pass of the model.

Parameters:

x (Tensor) – input image

Returns:

output prediction

Return type:

Tensor