TerraTorch
Compression
Neutral Codecs
Earth Observation
Isabelle-Wittmann commited on
Commit
d6fc4ea
·
1 Parent(s): b666947

add readme

Browse files

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

README.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ paper: https://arxiv.org/abs/2510.12670
4
+ homepage: https://github.com/IBM/TerraCodec
5
+ ---
6
+
7
+ # TerraCodec
8
+
9
+ **Neural Compression for Earth Observation**
10
+
11
+ [![arXiv](https://img.shields.io/badge/arXiv-2510.12670-b31b1b)](https://arxiv.org/abs/2510.12670)
12
+ [![GitHub](https://img.shields.io/badge/GitHub-IBM%2FTerraCodec-black?logo=github)](https://github.com/IBM/TerraCodec)
13
+ [![PyPI](https://img.shields.io/badge/PyPI-terracodec-blue?logo=pypi)](https://pypi.org/project/terracodec/)
14
+
15
+ 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.
16
+
17
+ 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.
18
+
19
+ ![Reconstructions](assets/reconstructions.png)
20
+
21
+ ---
22
+
23
+ # Model Family
24
+
25
+ | Model | Available Checkpoints | Description |
26
+ |---|---|---|
27
+ | `terracodec_v1_fp_s2l2a` | λ = 0.5, 2, 10, 40, 200 | Factorized-prior image codec. Smallest model and strong baseline for multispectral image compression. |
28
+ | `terracodec_v1_elic_s2l2a` | λ = 0.5, 2, 10, 40, 200 | Enhanced entropy model with spatial and channel context for improved rate–distortion performance. |
29
+ | `terracodec_v1_tt_s2l2a` | λ = 0.4, 1, 5, 20, 100, 200, 700 | Temporal Transformer codec modeling redundancy across seasonal image sequences. |
30
+ | `flextec_v1_s2l2a` | **Single checkpoint** (quality = 1–16) | Flexible-rate temporal codec. One model supports multiple compression levels via token-based quality settings. |
31
+
32
+ Lower λ / quality → **higher compression**
33
+ Higher λ / quality → **higher reconstruction quality**
34
+
35
+ ---
36
+
37
+ # Model Architecture
38
+
39
+ This repository contains the **TEC-ELIC** variant of TerraCodec.
40
+
41
+ [![TEC-ELIC Architecture](assets/TEC_image_architecture.png)](assets/TEC_image_architecture.png)
42
+
43
+ TEC-ELIC is a convolutional encoder–decoder neural compression model based on the Efficient Learned Image Compression (ELIC) architecture. The model predicts the mean and scale of latent variables using spatial and channel context together with a hyperprior.
44
+ This richer entropy model improves rate–distortion performance compared to the factorized prior model, at the cost of higher computational complexity. TEC-ELIC is optimized for 12-band Sentinel-2 imagery.
45
+
46
+ See the paper for additional architectural and training details.
47
+
48
+ ---
49
+
50
+ # Input Format
51
+
52
+ | Codec type | Expected shape | Example |
53
+ |-----------------|---------------------|-------------------------|
54
+ | Image codecs | `[B, C, H, W]` | `[1, 12, 256, 256]` |
55
+ | Temporal codecs | `[B, T, C, H, W]` | `[1, 4, 12, 256, 256]` |
56
+
57
+ - Inputs use **12 Sentinel‑2 L2A spectral bands**.
58
+ - Recommended spatial size: **256×256**.
59
+ - Temporal codecs were pretrained on four seasonal frames, but can process any number of timesteps during inference (higher T increases compute).
60
+
61
+ ---
62
+
63
+ # Normalization
64
+
65
+ Models were trained on **[SSL4EO-S12 v1.1](https://huggingface.co/datasets/embed2scale/SSL4EO-S12-v1.1)**.
66
+
67
+ Inputs should be standardized per spectral band using dataset statistics. For S2L2A:
68
+
69
+ ```python
70
+ 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])
71
+ 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])
72
+ ```
73
+
74
+ # Usage
75
+
76
+ Install TerraCodec:
77
+
78
+ ```
79
+ pip install terracodec
80
+ ```
81
+
82
+ Load pretrained models:
83
+ ```python
84
+ from terracodec import terracodec_v1_elic_s2l2a
85
+
86
+ model = terracodec_v1_elic_s2l2a(
87
+ pretrained=True,
88
+ compression=10
89
+ )
90
+
91
+ # Fast reconstruction (no bitstream)
92
+ reconstruction = model(inputs)
93
+
94
+ # True compression
95
+ compressed = model.compress(inputs)
96
+ reconstruction = model.decompress(**compressed)
97
+ ```
98
+
99
+ # Feedback
100
+ If you have questions, encounter issues or want to discuss improvements:
101
+ - open an issue or discussion on GitHub
102
+ - or contribute directly to the repository
103
+
104
+ GitHub repository: https://github.com/IBM/TerraCodec
105
+
106
+ # Citation
107
+ If you use TerraCodec in your research, please cite:
108
+ ```
109
+ @article{terracodec2025,
110
+ title = {TerraCodec: Neural Codecs for Earth Observation},
111
+ author = {Costa Watanabe, Julen and Wittmann, Isabelle and Blumenstiel, Benedikt},
112
+ journal = {arXiv preprint arXiv:2510.12670},
113
+ year = {2025}
114
+ }
115
+ ```
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