ChangeStar#

class torchgeo.models.ChangeStar(dense_feature_extractor, seg_classifier, changemixin, inference_mode='t1t2')[source]#

Bases: Module

The base class of the network architecture of ChangeStar.

ChangeStar is composed of an any segmentation model and a ChangeMixin module. This model is mainly used for binary/multi-class change detection under bitemporal supervision and single-temporal supervision. It features the property of segmentation architecture reusing, which is helpful to integrate advanced dense prediction (e.g., semantic segmentation) network architecture into change detection.

For multi-class change detection, semantic change prediction can be inferred by a binary change prediction from the ChangeMixin module and two semantic predictions from the Segmentation model.

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

__init__(dense_feature_extractor, seg_classifier, changemixin, inference_mode='t1t2')[source]#

Initializes a new ChangeStar model.

Parameters:
  • dense_feature_extractor (Module) – module for dense feature extraction, typically a semantic segmentation model without semantic segmentation head.

  • seg_classifier (Module) – semantic segmentation head, typically a convolutional layer followed by an upsampling layer.

  • changemixin (ChangeMixin) – torchgeo.models.ChangeMixin module

  • inference_mode (str) – name of inference mode 't1t2' | 't2t1' | 'mean'. 't1t2': concatenate bitemporal features in the order of t1->t2; 't2t1': concatenate bitemporal features in the order of t2->t1; 'mean': the weighted mean of the output of 't1t2' and 't1t2'

forward(x)[source]#

Forward pass of the model.

Parameters:

x (Tensor) – a bitemporal input tensor of shape [B, T, C, H, W]

Returns:

a dictionary containing bitemporal semantic segmentation logit and binary change detection logit/probability

Return type:

dict[str, Tensor]

class torchgeo.models.ChangeStarFarSeg(backbone='resnet50', classes=1, backbone_weights=None)[source]#

Bases: ChangeStar

The network architecture of ChangeStar(FarSeg).

ChangeStar(FarSeg) is composed of a FarSeg model and a ChangeMixin module.

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

__init__(backbone='resnet50', classes=1, backbone_weights=None)[source]#

Initializes a new ChangeStarFarSeg model.

Parameters:
  • backbone (str) – name of ResNet backbone

  • classes (int) – number of output segmentation classes

  • backbone_weights (WeightsEnum | None) – Pre-trained model weights to use.

Added in version 0.9: The backbone_weights parameter.

class torchgeo.models.ChangeMixin(in_channels=256, inner_channels=16, num_convs=4, scale_factor=4.0)[source]#

Bases: Module

This module enables any segmentation model to detect binary change.

The common usage is to attach this module on a segmentation model without the classification head.

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

__init__(in_channels=256, inner_channels=16, num_convs=4, scale_factor=4.0)[source]#

Initializes a new ChangeMixin module.

Parameters:
  • in_channels (int) – sum of channels of bitemporal feature maps

  • inner_channels (int) – number of channels of inner feature maps

  • num_convs (int) – number of convolution blocks

  • scale_factor (float) – number of upsampling factor

forward(bi_feature)[source]#

Forward pass of the model.

Parameters:

bi_feature (Tensor) – input bitemporal feature maps of shape [b, t, c, h, w]

Returns:

a list of bidirected output predictions

Return type:

list[Tensor]