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

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +102 -0
README.md ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ **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(
49
+ pretrained=True,
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.