Run this model with HF Jobs
Run embed2scale/TerraCodec-1.0-FP-S2L2A on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/embed2scale/TerraCodec-1.0-FP-S2L2A. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/embed2scale/TerraCodec-1.0-FP-S2L2A on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use embed2scale/TerraCodec-1.0-FP-S2L2A with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TerraTorch
How to use embed2scale/TerraCodec-1.0-FP-S2L2A with TerraTorch:
from terratorch.registry import BACKBONE_REGISTRY model = BACKBONE_REGISTRY.build("embed2scale/TerraCodec-1.0-FP-S2L2A") - Notebooks
- Google Colab
- Kaggle
Isabelle Wittmann commited on
Commit ·
2392f74
1
Parent(s): 230ffab
update readme
Browse filesSigned-off-by: Isabelle Wittmann <isabelle.wittmann1@ibm.com>
Files changed (3)
4 unmodified lines567891011121314151617181920212223242526272829303132333435363738394041424344454647481 unmodified line50515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011024 unmodified lines---# TerraCodec**Neural Compression for Earth Observation**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.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.📄 Paper: https://arxiv.org/abs/2510.12670💻 GitHub: https://github.com/IBM/TerraCodec---# Models| Model | Available Checkpoints | Description ||---|---|---|| `terracodec_v1_fp_s2l2a` | λ = 0.5, 2, 10, 40, 200 | Factorized-prior image codec. Smallest model and strong baseline for multispectral image compression. || `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. || `terracodec_v1_tt_s2l2a` | λ = 0.4, 1, 5, 20, 100, 200, 700 | Temporal Transformer codec modeling redundancy across seasonal multispectral image sequences. || `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. |Lower λ/ quality → **higher compression**Higher λ/ quality → **higher reconstruction quality**See the paper and GitHub for details.---# Installation```bashpip install terracodec```---# QuickStart```bashfrom terracodec import terracodec_v1_fp_s2l2amodel = terracodec_v1_fp_s2l2a(1 unmodified linecompression=10)# Fast Reconstructionreconstruction = model(inputs)# True Compressioncompressed = model.compress(inputs)reconstruction = model.decompress(**compressed)```---# Input Format| Codec type | Shape | Example ||---|---|---|| Image codecs | `[B, C, H, W]` | `[1, 12, 256, 256]` || Temporal codecs | `[B, T, C, H, W]` | `[1, 4, 12, 256, 256]` |- **12 spectral bands** (Sentinel-2 L2A)- **Spatial size:** 256×256 recommended. TEC-FP accepts arbitrary sizes; all other models expect 256×256.- **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.### NormalizationModels 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.For S2L2A:```pythonmean = 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])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])```---## Citation```bibtex@article{terracodec2025,title = {TerraCodec: Neural Codecs for Earth Observation},author = {Costa Watanabe, Julen and Wittmann, Isabelle and Blumenstiel, Benedikt},journal = {arXiv preprint arXiv:2510.12670},year = {2025}}```---## LicenseApache 2.0.4 unmodified lines5678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788891 unmodified line9192939495969798991001011021031041051061071081091101111121131141151161171184 unmodified lines---# TerraCodec**Neural Compression for Earth Observation**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.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.---# Model Family| Model | Available Checkpoints | Description ||---|---|---|| `terracodec_v1_fp_s2l2a` | λ = 0.5, 2, 10, 40, 200 | Factorized-prior image codec. Smallest model and strong baseline for multispectral image compression. || `terracodec_v1_elic_s2l2a` | λ = 0.5, 2, 10, 40, 200 | Enhanced entropy model with spatial and channel context for improved rate–distortion performance. || `terracodec_v1_tt_s2l2a` | λ = 0.4, 1, 5, 20, 100, 200, 700 | Temporal Transformer codec modeling redundancy across seasonal image sequences. || `flextec_v1_s2l2a` | **Single checkpoint** (quality = 1–16) | Flexible-rate temporal codec. One model supports multiple compression levels via token-based quality settings. |Lower λ / quality → **higher compression**Higher λ / quality → **higher reconstruction quality**---# Model ArchitectureThis repository contains the **TEC-FP (Factorized Prior)** variant of TerraCodec.[](assets/TEC_image_architecture.png)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.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.See the paper for additional architectural and training details.---# Input Format| Codec type | Expected shape | Example ||-----------------|---------------------|-------------------------|| Image codecs | `[B, C, H, W]` | `[1, 12, 256, 256]` || Temporal codecs | `[B, T, C, H, W]` | `[1, 4, 12, 256, 256]` |- Inputs use **12 Sentinel‑2 L2A spectral bands**.- Recommended spatial size: **256×256**. TEC‑FP supports arbitrary spatial sizes; other models expect 256×256.- Temporal codecs were pretrained on four seasonal frames, but can process any number of timesteps during inference (higher T increases compute).---# NormalizationModels 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. For S2L2A:```pythonmean = 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])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])```# UsageInstall TerraCodec:```pip install terracodec```Load pretrained models:```pythonfrom terracodec import terracodec_v1_fp_s2l2amodel = terracodec_v1_fp_s2l2a(1 unmodified linecompression=10)# Fast reconstruction (no bitstream)reconstruction = model(inputs)# True compressioncompressed = model.compress(inputs)reconstruction = model.decompress(**compressed)```# FeedbackIf you have questions, encounter issues or want to discuss improvements:- open an issue or discussion on GitHub- or contribute directly to the repositoryGitHub repository: https://github.com/IBM/TerraCodec# CitationIf you use TerraCodec in your research, please cite:```@article{terracodec2025,title = {TerraCodec: Neural Codecs for Earth Observation},author = {Costa Watanabe, Julen and Wittmann, Isabelle and Blumenstiel, Benedikt},journal = {arXiv preprint arXiv:2510.12670},year = {2025}}```
README.md+68-52
assets/TEC_image_architecture.pngAdded

Large File Pointer Details
- SHA256: 30590528db057ca4b69ad64ad8cc65e7b96e122244bae4f4e509916f8e68571b
- Pointer size: 131 Bytes
- Size of remote file: 592 kB
assets/reconstructions.pngAdded

Large File Pointer Details
- SHA256: f0350b00e0f5e0f4fa7b8de340b57556b8651cb3af9146f22ea024772bb6e37a
- Pointer size: 132 Bytes
- Size of remote file: 5.46 MB