TerraTorch
Compression
Neutral Codecs
Earth Observation
Isabelle-Wittmann commited on
Commit
2392f74
·
1 Parent(s): 230ffab

update readme

Browse files

Signed-off-by: Isabelle Wittmann <isabelle.wittmann1@ibm.com>

README.md CHANGED
@@ -5,44 +5,85 @@ homepage: https://github.com/IBM/TerraCodec
5
  ---
6
 
7
  # TerraCodec
 
8
  **Neural Compression for Earth Observation**
9
 
10
- TerraCodec (TEC) is a family of pretrained neural compression codecs for **multispectral Sentinel-2 satellite imagery**. The models compress optical Earth observation data using learned latent representations and entropy coding.
 
 
 
 
 
 
11
 
12
- Compared to classical codecs such as JPEG2000 or WebP, TerraCodec achieves **3–10× higher compression at comparable reconstruction quality** on multispectral satellite imagery. Temporal models further improve compression by exploiting redundancy across seasonal image sequences.
13
 
14
- 📄 Paper: https://arxiv.org/abs/2510.12670
15
- 💻 GitHub: https://github.com/IBM/TerraCodec
16
 
17
  ---
18
 
19
- # Models
20
 
21
  | Model | Available Checkpoints | Description |
22
  |---|---|---|
23
  | `terracodec_v1_fp_s2l2a` | λ = 0.5, 2, 10, 40, 200 | Factorized-prior image codec. Smallest model and strong baseline for multispectral image compression. |
24
- | `terracodec_v1_elic_s2l2a` | λ = 0.5, 2, 10, 40, 200 | Enhanced entropy model with spatial and channel context, providing improved rate–distortion performance for image compression. |
25
- | `terracodec_v1_tt_s2l2a` | λ = 0.4, 1, 5, 20, 100, 200, 700 | Temporal Transformer codec modeling redundancy across seasonal multispectral image sequences. |
26
- | `flextec_v1_s2l2a` | **Single checkpoint** (quality = 1–16) | Flexible-rate temporal codec. One model supports multiple compression levels via token-based quality settings at inference time. |
 
 
 
 
 
 
 
27
 
28
- Lower λ/ quality **higher compression**
29
- Higher λ/ quality → **higher reconstruction quality**
30
 
31
- See the paper and GitHub for details.
 
 
 
 
 
32
 
33
  ---
34
 
35
- # Installation
 
 
 
 
 
36
 
37
- ```bash
38
- pip install terracodec
39
- ```
40
 
41
  ---
42
 
43
- # QuickStart
44
 
45
- ```bash
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  from terracodec import terracodec_v1_fp_s2l2a
47
 
48
  model = terracodec_v1_fp_s2l2a(
@@ -50,53 +91,28 @@ model = terracodec_v1_fp_s2l2a(
50
  compression=10
51
  )
52
 
53
- # Fast Reconstruction
54
  reconstruction = model(inputs)
55
 
56
- # True Compression
57
  compressed = model.compress(inputs)
58
  reconstruction = model.decompress(**compressed)
59
  ```
60
 
61
- ---
62
-
63
- # Input Format
64
-
65
-
66
- | Codec type | Shape | Example |
67
- |---|---|---|
68
- | Image codecs | `[B, C, H, W]` | `[1, 12, 256, 256]` |
69
- | Temporal codecs | `[B, T, C, H, W]` | `[1, 4, 12, 256, 256]` |
70
-
71
- - **12 spectral bands** (Sentinel-2 L2A)
72
- - **Spatial size:** 256×256 recommended. TEC-FP accepts arbitrary sizes; all other models expect 256×256.
73
- - **Temporal models:** Models are pretrained on four seasonal frames but can process an arbitrary number of input timesteps at inference time. Using more frames increases the computational cost and therefore the required inference time.
74
-
75
- ### Normalization
76
 
77
- Models were trained on [SSL4EO-S12 v1.1](https://huggingface.co/datasets/embed2scale/SSL4EO-S12-v1.1). Inputs should be standardized per spectral band using dataset statistics.
78
- For S2L2A:
79
 
80
- ```python
81
- mean = torch.tensor([793.243, 924.863, 1184.553, 1340.936, 1671.402, 2240.082, 2468.412, 2563.243, 2627.704, 2711.071, 2416.714, 1849.625])
82
- std = torch.tensor([1160.144, 1201.092, 1219.943, 1397.225, 1400.035, 1373.136, 1429.170, 1485.025, 1447.836, 1652.703, 1471.002, 1365.307])
83
  ```
84
-
85
- ---
86
-
87
- ## Citation
88
-
89
- ```bibtex
90
  @article{terracodec2025,
91
  title = {TerraCodec: Neural Codecs for Earth Observation},
92
  author = {Costa Watanabe, Julen and Wittmann, Isabelle and Blumenstiel, Benedikt},
93
  journal = {arXiv preprint arXiv:2510.12670},
94
  year = {2025}
95
  }
96
- ```
97
-
98
- ---
99
-
100
- ## License
101
-
102
- Apache 2.0.
 
5
  ---
6
 
7
  # TerraCodec
8
+
9
  **Neural Compression for Earth Observation**
10
 
11
+ ![License](https://img.shields.io/badge/License-Apache%202.0-blue)
12
+ ![arXiv](https://img.shields.io/badge/arXiv-2510.12670-b31b1b)
13
+ ![GitHub](https://img.shields.io/badge/GitHub-IBM%2FTerraCodec-black?logo=github)
14
+ ![PyPI](https://img.shields.io/badge/PyPI-terracodec-blue?logo=pypi)
15
+
16
+ TerraCodec (TEC) is a family of pretrained neural compression codecs for **multispectral Sentinel-2 satellite imagery**.
17
+ The models compress optical Earth observation data using learned latent representations and entropy coding.
18
 
19
+ Compared to classical codecs such as JPEG2000 or WebP, TerraCodec achieves **3–10× higher compression at comparable reconstruction quality** on multispectral satellite imagery. Temporal models further improve compression by exploiting redundancy across seasonal image sequences of satellite imagery.
20
 
21
+ ![Reconstructions](assets/reconstructions.png)
 
22
 
23
  ---
24
 
25
+ # Model Family
26
 
27
  | Model | Available Checkpoints | Description |
28
  |---|---|---|
29
  | `terracodec_v1_fp_s2l2a` | λ = 0.5, 2, 10, 40, 200 | Factorized-prior image codec. Smallest model and strong baseline for multispectral image compression. |
30
+ | `terracodec_v1_elic_s2l2a` | λ = 0.5, 2, 10, 40, 200 | Enhanced entropy model with spatial and channel context for improved rate–distortion performance. |
31
+ | `terracodec_v1_tt_s2l2a` | λ = 0.4, 1, 5, 20, 100, 200, 700 | Temporal Transformer codec modeling redundancy across seasonal image sequences. |
32
+ | `flextec_v1_s2l2a` | **Single checkpoint** (quality = 1–16) | Flexible-rate temporal codec. One model supports multiple compression levels via token-based quality settings. |
33
+
34
+ Lower λ / quality → **higher compression**
35
+ Higher λ / quality → **higher reconstruction quality**
36
+
37
+ ---
38
+
39
+ # Model Architecture
40
 
41
+ This repository contains the **TEC-FP (Factorized Prior)** variant of TerraCodec.
 
42
 
43
+ [![TEC-ELIC Architecture](assets/TEC_image_architecture.png)](assets/TEC_image_architecture.png)
44
+
45
+ TEC-FP is a convolutional encoder–decoder neural compression model with a fully factorized entropy model for the latent representation. Each quantized latent variable is modeled independently without spatial or channel context.
46
+ This design enables efficient parallel entropy coding. TEC-FP is the smallest and fastest image codec in the TerraCodec family and is optimized for 12-band Sentinel-2 imagery.
47
+
48
+ See the paper for additional architectural and training details.
49
 
50
  ---
51
 
52
+ # Input Format
53
+
54
+ | Codec type | Expected shape | Example |
55
+ |-----------------|---------------------|-------------------------|
56
+ | Image codecs | `[B, C, H, W]` | `[1, 12, 256, 256]` |
57
+ | Temporal codecs | `[B, T, C, H, W]` | `[1, 4, 12, 256, 256]` |
58
 
59
+ - Inputs use **12 Sentinel‑2 L2A spectral bands**.
60
+ - Recommended spatial size: **256×256**. TEC‑FP supports arbitrary spatial sizes; other models expect 256×256.
61
+ - Temporal codecs were pretrained on four seasonal frames, but can process any number of timesteps during inference (higher T increases compute).
62
 
63
  ---
64
 
65
+ # Normalization
66
 
67
+ Models were trained on **[SSL4EO-S12 v1.1](https://huggingface.co/datasets/embed2scale/SSL4EO-S12-v1.1)**.
68
+
69
+ Inputs should be standardized per spectral band using dataset statistics. For S2L2A:
70
+
71
+ ```python
72
+ mean = torch.tensor([793.243, 924.863, 1184.553, 1340.936, 1671.402, 2240.082, 2468.412, 2563.243, 2627.704, 2711.071, 2416.714, 1849.625])
73
+
74
+ std = torch.tensor([1160.144, 1201.092, 1219.943, 1397.225, 1400.035, 1373.136, 1429.170, 1485.025, 1447.836, 1652.703, 1471.002, 1365.307])
75
+ ```
76
+
77
+ # Usage
78
+
79
+ Install TerraCodec:
80
+
81
+ ```
82
+ pip install terracodec
83
+ ```
84
+
85
+ Load pretrained models:
86
+ ```python
87
  from terracodec import terracodec_v1_fp_s2l2a
88
 
89
  model = terracodec_v1_fp_s2l2a(
 
91
  compression=10
92
  )
93
 
94
+ # Fast reconstruction (no bitstream)
95
  reconstruction = model(inputs)
96
 
97
+ # True compression
98
  compressed = model.compress(inputs)
99
  reconstruction = model.decompress(**compressed)
100
  ```
101
 
102
+ # Feedback
103
+ If you have questions, encounter issues or want to discuss improvements:
104
+ - open an issue or discussion on GitHub
105
+ - or contribute directly to the repository
 
 
 
 
 
 
 
 
 
 
 
106
 
107
+ GitHub repository: https://github.com/IBM/TerraCodec
 
108
 
109
+ # Citation
110
+ If you use TerraCodec in your research, please cite:
 
111
  ```
 
 
 
 
 
 
112
  @article{terracodec2025,
113
  title = {TerraCodec: Neural Codecs for Earth Observation},
114
  author = {Costa Watanabe, Julen and Wittmann, Isabelle and Blumenstiel, Benedikt},
115
  journal = {arXiv preprint arXiv:2510.12670},
116
  year = {2025}
117
  }
118
+ ```
 
 
 
 
 
 
assets/TEC_image_architecture.png ADDED

Git LFS Details

  • SHA256: 30590528db057ca4b69ad64ad8cc65e7b96e122244bae4f4e509916f8e68571b
  • Pointer size: 131 Bytes
  • Size of remote file: 592 kB
assets/reconstructions.png ADDED

Git LFS Details

  • SHA256: f0350b00e0f5e0f4fa7b8de340b57556b8651cb3af9146f22ea024772bb6e37a
  • Pointer size: 132 Bytes
  • Size of remote file: 5.46 MB