Skip to content

ClarkCGA/terratorch-explainability

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TerraTorch

huggingface pypi tests MkDocs cov PyPI Downloads

Changes for Development and Embedding Generation:

Editable Installation from Local Files

The Dockerfile has been modified to copy the package from local files and install in an editable configuration rather than installing from the public release. This takes longer on startup, as Terratorch must be installed from local files each time the container starts for edits to be reflected in those files. To disable this behavior and build a more permanent version of the Docker image from local files, swap out the bash command at the end of the Dockerfile for the copy command in the middle of the Dockerfile, and uncomment Terratorch in the pip install line.

Addition of compose.yml

The compose.yml is the preferred way of running this workflow. A template has been provided.

Addition of Embedding Generation Task

The Embedding Generation task has been added to the Terratorch package

Running Embedding Generation

The embedding generation workflow relies on the terratorch predict method. Connect to the terminal of the container and activate the Terratorch virtual environment using:

source /opt/app-root/src/venv/bin/activate

Using this line from the official tutorial as an example:

terratorch predict -c burn_scars_config.yaml --predict_output_dir outputs/ --data.init_args.predict_data_root examples/ --ckpt_path Prithvi_EO_V2_300M_BurnScars.pt

e.g.

terratorch predict -c /opt/app-root/src/terratorch/examples/confs/embedding_generation/burn_scars_embedding_config.yaml --data.init_args.predict_data_root /data/Prithvi-EO-2.0-300M-BurnScars/examples/

Change the output dir and ckpt path according to the local filestructure.

Overview

TerraTorch is a PyTorch domain library based on PyTorch Lightning and the TorchGeo domain library for geospatial data.


YouTube Watch the latest recording on YouTube: Earth observation foundation models with Prithvi-EO-2.0 and TerraTorch YouTube

TerraTorch’s main purpose is to provide a flexible fine-tuning framework for Geospatial Foundation Models, which can be interacted with at different abstraction levels. The library provides:

  • Convenient modelling tools:
    • Flexible trainers for Image Segmentation, Classification and Pixel Wise Regression fine-tuning tasks
    • Model factories that allow to easily combine backbones and decoders for different tasks
    • Ready-to-go datasets and datamodules that require only to point to your data with no need of creating new custom classes
    • Launching of fine-tuning tasks through CLI and flexible configuration files, or via jupyter notebooks
  • Easy access to:

Install

Pip

In order to use th file pyproject.toml it is necessary to guarantee pip>=21.8. If necessary upgrade pip using python -m pip install --upgrade pip.

For a stable point-release, use pip install terratorch==<version>.

To get the most recent version of the main branch, install the library with pip install git+https://github.com/IBM/terratorch.git.

TerraTorch requires gdal to be installed, which can be quite a complex process. If you don't have GDAL set up on your system, we recommend using a conda environment and installing it with conda install -c conda-forge gdal.

To install as a developer (e.g. to extend the library):

git clone https://github.com/IBM/terratorch.git
cd terratorch
pip install -r requirements_test.txt
conda install -c conda-forge gdal
pip install -e .

To install terratorch with partial (work in development) support for Weather Foundation Models, pip install -e .[wxc], which currently works just for Python >= 3.11.

Documentation

To get started, check out the quick start guide.

Developers, check out the architecture overview.

TerraTorch: The Geospatial Foundation Models Toolkit on arXiv

Contributing

This project welcomes contributions and suggestions. Ways to contribute or get involved:

You can find more detailed contribution guidelines here.

A simple hint for any contributor. If you want to meet the GitHub DCO checks, just do your commits as below:

git commit -s -m <message>

It will sign the commit with your ID and the check will be met.

License

This project is primarily licensed under the Apache License 2.0.

However, some files contain code licensed under the MIT License. These files are explicitly listed in MIT_FILES.txt.

By contributing to this repository, you agree that your contributions will be licensed under the Apache 2.0 License unless otherwise stated.

For more details, see the LICENSE file.

About

Experimental Integration of Explanability with Terratorch

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.9%
  • Other 0.1%