CROMA#

class torchgeo.models.CROMA(modalities=['sar', 'optical'], encoder_dim=768, encoder_depth=12, num_heads=16, patch_size=8, image_size=120)[source]#

Bases: Module

Pretrained CROMA model.

Corresponds to the pretrained CROMA model found in the CROMA repository:

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

__init__(modalities=['sar', 'optical'], encoder_dim=768, encoder_depth=12, num_heads=16, patch_size=8, image_size=120)[source]#

Initialize the CROMA model.

Parameters:
  • modalities (Sequence[str]) – List of modalities used during forward pass, list can contain ‘sar’, ‘optical’, or both.

  • encoder_dim (int) – Dimension of the encoder.

  • encoder_depth (int) – Depth of the encoder.

  • num_heads (int) – Number of heads for the multi-head attention, should be power of 2.

  • patch_size (int) – Size of the patches.

  • image_size (int) – Size of the input images, CROMA was trained on 120x120 images, must be a multiple of 8.

Raises:

AssertionError – If any arguments are not valid.

forward(x_sar=None, x_optical=None)[source]#

Forward pass of the CROMA model.

Parameters:
  • x_sar (Tensor | None) – Input mini-batch of SAR images [B, 2, H, W].

  • x_optical (Tensor | None) – Input mini-batch of optical images [B, 12, H, W].

torchgeo.models.croma_base(weights=None, *args, **kwargs)[source]#

CROMA base model.

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

Added in version 0.7.

Parameters:
  • weights (CROMABase_Weights | None) – Pretrained weights to load.

  • *args (Any) – Additional arguments to pass to :class:CROMA.`

  • **kwargs (Any) – Additional keyword arguments to pass to :class:CROMA.`

Returns:

CROMA base model.

Return type:

CROMA

torchgeo.models.croma_large(weights=None, *args, **kwargs)[source]#

CROMA large model.

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

Added in version 0.7.

Parameters:
  • weights (CROMALarge_Weights | None) – Pretrained weights to load.

  • *args (Any) – Additional arguments to pass to :class:CROMA.`

  • **kwargs (Any) – Additional keyword arguments to pass to :class:CROMA.`

Returns:

CROMA large model.

Return type:

CROMA

class torchgeo.models.CROMABase_Weights(*values)[source]#

Bases: WeightsEnum

CROMA base model weights.

Added in version 0.7.

__new__(value)#
class torchgeo.models.CROMALarge_Weights(*values)[source]#

Bases: WeightsEnum

CROMA large model weights.

Added in version 0.7.

__new__(value)#