Shortcuts

torchgeo.transforms

TorchGeo transforms.

class torchgeo.transforms.AppendBNDVI(index_nir, index_blue)

Bases: AppendNormalizedDifferenceIndex

Blue Normalized Difference Vegetation Index (BNDVI).

Computes the following index:

\[\text{BNDVI} = \frac{\text{NIR} - \text{B}}{\text{NIR} + \text{B}}\]

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

New in version 0.3.

__init__(index_nir, index_blue)[source]

Initialize a new transform instance.

Parameters
  • index_nir (int) – index of the NIR band, e.g. B8 in Sentinel 2 imagery

  • index_blue (int) – index of the Blue band, e.g. B2 in Sentinel 2 imagery

class torchgeo.transforms.AppendGBNDVI(index_nir, index_green, index_blue)

Bases: AppendTriBandNormalizedDifferenceIndex

Green-Blue Normalized Difference Vegetation Index (GBNDVI).

Computes the following index:

\[\text{GBNDVI} = \frac{\text{NIR} - (\text{G} + \text{B})}{\text{NIR} + (\text{G} + \text{B})}\]

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

New in version 0.3.

__init__(index_nir, index_green, index_blue)[source]

Initialize a new transform instance.

Parameters
  • index_nir (int) – index of the NIR band, e.g. B8 in Sentinel 2 imagery

  • index_green (int) – index of the Green band, B3 in Sentinel 2 imagery

  • index_blue (int) – index of the Blue band, B2 in Sentinel 2 imagery

class torchgeo.transforms.AppendGNDVI(index_nir, index_green)

Bases: AppendNormalizedDifferenceIndex

Green Normalized Difference Vegetation Index (GNDVI).

Computes the following index:

\[\text{GNDVI} = \frac{\text{NIR} - \text{G}}{\text{NIR} + \text{G}}\]

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

New in version 0.3.

__init__(index_nir, index_green)[source]

Initialize a new transform instance.

Parameters
  • index_nir (int) – index of the NIR band, e.g. B8 in Sentinel 2 imagery

  • index_green (int) – index of the Green band, e.g. B3 in Sentinel 2 imagery

class torchgeo.transforms.AppendGRNDVI(index_nir, index_green, index_red)

Bases: AppendTriBandNormalizedDifferenceIndex

Green-Red Normalized Difference Vegetation Index (GRNDVI).

Computes the following index:

\[\text{GRNDVI} = \frac{\text{NIR} - (\text{G} + \text{R})}{\text{NIR} + (\text{G} + \text{R})}\]

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

New in version 0.3.

__init__(index_nir, index_green, index_red)[source]

Initialize a new transform instance.

Parameters
  • index_nir (int) – index of the NIR band, e.g. B8 in Sentinel 2 imagery

  • index_green (int) – index of the Green band, B3 in Sentinel 2 imagery

  • index_red (int) – index of the Red band, B4 in Sentinel 2 imagery

class torchgeo.transforms.AppendNBR(index_nir, index_swir)

Bases: AppendNormalizedDifferenceIndex

Normalized Burn Ratio (NBR).

Computes the following index:

\[\text{NBR} = \frac{\text{NIR} - \text{SWIR}}{\text{NIR} + \text{SWIR}}\]

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

New in version 0.2.0.

__init__(index_nir, index_swir)[source]

Initialize a new transform instance.

Parameters
  • index_nir (int) – index of the Near Infrared (NIR) band in the image

  • index_swir (int) – index of the Short-wave Infrared (SWIR) band in the image

class torchgeo.transforms.AppendNDBI(index_swir, index_nir)

Bases: AppendNormalizedDifferenceIndex

Normalized Difference Built-up Index (NDBI).

Computes the following index:

\[\text{NDBI} = \frac{\text{SWIR} - \text{NIR}}{\text{SWIR} + \text{NIR}}\]

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

__init__(index_swir, index_nir)[source]

Initialize a new transform instance.

Parameters
  • index_swir (int) – index of the Short-wave Infrared (SWIR) band in the image

  • index_nir (int) – index of the Near Infrared (NIR) band in the image

class torchgeo.transforms.AppendNDRE(index_nir, index_vre1)

Bases: AppendNormalizedDifferenceIndex

Normalized Difference Red Edge Vegetation Index (NDRE).

Computes the following index:

\[\text{NDRE} = \frac{\text{NIR} - \text{VRE1}}{\text{NIR} + \text{VRE1}}\]

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

New in version 0.3.

__init__(index_nir, index_vre1)[source]

Initialize a new transform instance.

Parameters
  • index_nir (int) – index of the NIR band, e.g. B8 in Sentinel 2 imagery

  • index_vre1 (int) – index of the Red Edge band, B5 in Sentinel 2 imagery

class torchgeo.transforms.AppendNDSI(index_green, index_swir)

Bases: AppendNormalizedDifferenceIndex

Normalized Difference Snow Index (NDSI).

Computes the following index:

\[\text{NDSI} = \frac{\text{G} - \text{SWIR}}{\text{G} + \text{SWIR}}\]

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

__init__(index_green, index_swir)[source]

Initialize a new transform instance.

Parameters
  • index_green (int) – index of the Green band in the image

  • index_swir (int) – index of the Short-wave Infrared (SWIR) band in the image

class torchgeo.transforms.AppendNDVI(index_red, index_nir)

Bases: AppendNormalizedDifferenceIndex

Normalized Difference Vegetation Index (NDVI).

Computes the following index:

\[\text{NDVI} = \frac{\text{R} - \text{NIR}}{\text{R} + \text{NIR}}\]

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

__init__(index_red, index_nir)[source]

Initialize a new transform instance.

Parameters
  • index_red (int) – index of the Red band in the image

  • index_nir (int) – index of the Near Infrared (NIR) band in the image

class torchgeo.transforms.AppendNDWI(index_green, index_nir)

Bases: AppendNormalizedDifferenceIndex

Normalized Difference Water Index (NDWI).

Computes the following index:

\[\text{NDWI} = \frac{\text{G} - \text{NIR}}{\text{G} + \text{NIR}}\]

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

__init__(index_green, index_nir)[source]

Initialize a new transform instance.

Parameters
  • index_green (int) – index of the Green band in the image

  • index_nir (int) – index of the Near Infrared (NIR) band in the image

class torchgeo.transforms.AppendNormalizedDifferenceIndex(index_a, index_b)

Bases: Module

Append normalized difference index as channel to image tensor.

Computes the following index:

\[\text{NDI} = \frac{A - B}{A + B}\]

New in version 0.2.

__init__(index_a, index_b)[source]

Initialize a new transform instance.

Parameters
  • index_a (int) – reference band channel index

  • index_b (int) – difference band channel index

forward(sample)[source]

Compute and append normalized difference index to image.

Parameters

sample (Dict[str, Tensor]) – a sample or batch dict

Returns

the transformed sample

Return type

Dict[str, Tensor]

class torchgeo.transforms.AppendRBNDVI(index_nir, index_red, index_blue)

Bases: AppendTriBandNormalizedDifferenceIndex

Red-Blue Normalized Difference Vegetation Index (RBNDVI).

Computes the following index:

\[\text{RBNDVI} = \frac{\text{NIR} - (\text{R} + \text{B})}{\text{NIR} + (\text{R} + \text{B})}\]

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

New in version 0.3.

__init__(index_nir, index_red, index_blue)[source]

Initialize a new transform instance.

Parameters
  • index_nir (int) – index of the NIR band, e.g. B8 in Sentinel 2 imagery

  • index_red (int) – index of the Red band, B4 in Sentinel 2 imagery

  • index_blue (int) – index of the Blue band, B2 in Sentinel 2 imagery

class torchgeo.transforms.AppendSWI(index_red, index_swir)

Bases: AppendNormalizedDifferenceIndex

Standardized Water-Level Index (SWI).

Computes the following index:

\[\text{SWI} = \frac{\text{R} - \text{SWIR}}{\text{R} + \text{SWIR}}\]

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

New in version 0.3.

__init__(index_red, index_swir)[source]

Initialize a new transform instance.

Parameters
  • index_red (int) – index of the VRE1 band, e.g. B5 in Sentinel 2 imagery

  • index_swir (int) – index of the SWIR2 band, e.g. B11 in Sentinel 2 imagery

class torchgeo.transforms.AppendTriBandNormalizedDifferenceIndex(index_a, index_b, index_c)

Bases: Module

Append normalized difference index involving 3 bands as channel to image tensor.

Computes the following index:

\[\text{NDI} = \frac{A - (B + C)}{A + (B + C)}\]

New in version 0.3.

__init__(index_a, index_b, index_c)[source]

Initialize a new transform instance.

Parameters
  • index_a (int) – reference band channel index

  • index_b (int) – difference band channel index of component 1

  • index_c (int) – difference band channel index of component 2

forward(sample)[source]

Compute and append tri-band normalized difference index to image.

Parameters

sample (Dict[str, Tensor]) – a sample or batch dict

Returns

the transformed sample

Return type

Dict[str, Tensor]

class torchgeo.transforms.AugmentationSequential(*args, data_keys)

Bases: Module

Wrapper around kornia AugmentationSequential to handle input dicts.

__init__(*args, data_keys)[source]

Initialize a new augmentation sequential instance.

Parameters
  • *args (Module) – Sequence of kornia augmentations

  • data_keys (List[str]) – List of inputs to augment (e.g. [“image”, “mask”, “boxes”])

forward(sample)[source]

Perform augmentations and update data dict.

Parameters

sample (Dict[str, Tensor]) – the input

Returns

the augmented input

Return type

Dict[str, Tensor]

Read the Docs v: v0.3.0
Versions
latest
stable
v0.3.0
v0.2.1
v0.2.0
v0.1.1
v0.1.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources