--- license: odc-by language: - en tags: - remote-sensing - earth-observation - satellite - aerial - multispectral - feature-extraction - vision - satlaspretrain - transformers library_name: transformers pipeline_tag: feature-extraction --- # SatlasPretrain Transformers Models Hugging Face–compatible checkpoints from the official [SatlasPretrain](https://github.com/allenai/satlas) foundation models (ICCV 2023). Each subfolder is a standalone model repo layout (`config.json`, `model.safetensors`, preprocessor, and remote code) for feature extraction on satellite and aerial imagery. ## Model Description These models are remote sensing encoders pretrained on the [SatlasPretrain dataset](https://github.com/allenai/satlas/blob/main/SatlasPretrain.md) covering Sentinel-2, Landsat 8/9, and high-resolution aerial imagery. This collection bundles **19 checkpoints** spanning: - **Architectures:** Swin-v2-Base, Swin-v2-Tiny, ResNet50, ResNet152 - **Input sources:** Sentinel-2, Landsat, aerial - **Modes:** single-image (SI) and multi-image temporal max-pooling (MI) - **Band configs:** RGB (3ch), multispectral (9ch), Landsat all-bands (11ch) All folders ship self-contained remote code (`modeling_satlaspretrain.py`, processor, pipeline) and load with `trust_remote_code=True`. **Developed by:** [Allen AI / Satlas](https://github.com/allenai/satlas) **Packaged for Hugging Face by:** BiliSakura **License (weights):** [ODC-BY](https://github.com/allenai/satlas/blob/main/DataLicense) **Original paper:** [SatlasPretrain: A Large-Scale Dataset for Remote Sensing Image Understanding](https://openaccess.thecvf.com/content/ICCV2023/html/Bastani_SatlasPretrain_A_Large-Scale_Dataset_for_Remote_Sensing_Image_Understanding_ICCV_2023_paper.html) ## Available checkpoints (19 models) | Folder | Source | Backbone | Mode | Bands | |--------|--------|----------|------|-------| | `satlaspretrain-sentinel2-swinb-si-rgb` | Sentinel-2 | Swin-B | SI | RGB | | `satlaspretrain-sentinel2-swinb-mi-rgb` | Sentinel-2 | Swin-B | MI | RGB | | `satlaspretrain-sentinel2-swinb-si-ms` | Sentinel-2 | Swin-B | SI | MS (9ch) | | `satlaspretrain-sentinel2-swinb-mi-ms` | Sentinel-2 | Swin-B | MI | MS (9ch) | | `satlaspretrain-sentinel2-swint-si-rgb` | Sentinel-2 | Swin-T | SI | RGB | | `satlaspretrain-sentinel2-swint-mi-rgb` | Sentinel-2 | Swin-T | MI | RGB | | `satlaspretrain-sentinel2-swint-si-ms` | Sentinel-2 | Swin-T | SI | MS (9ch) | | `satlaspretrain-sentinel2-swint-mi-ms` | Sentinel-2 | Swin-T | MI | MS (9ch) | | `satlaspretrain-sentinel2-resnet50-si-rgb` | Sentinel-2 | ResNet50 | SI | RGB | | `satlaspretrain-sentinel2-resnet50-mi-rgb` | Sentinel-2 | ResNet50 | MI | RGB | | `satlaspretrain-sentinel2-resnet50-mi-ms` | Sentinel-2 | ResNet50 | MI | MS (9ch) | | `satlaspretrain-sentinel2-resnet152-si-rgb` | Sentinel-2 | ResNet152 | SI | RGB | | `satlaspretrain-sentinel2-resnet152-si-ms` | Sentinel-2 | ResNet152 | SI | MS (9ch) | | `satlaspretrain-sentinel2-resnet152-mi-rgb` | Sentinel-2 | ResNet152 | MI | RGB | | `satlaspretrain-sentinel2-resnet152-mi-ms` | Sentinel-2 | ResNet152 | MI | MS (9ch) | | `satlaspretrain-landsat-swinb-si` | Landsat 8/9 | Swin-B | SI | All (11ch) | | `satlaspretrain-landsat-swinb-mi` | Landsat 8/9 | Swin-B | MI | All (11ch) | | `satlaspretrain-aerial-swinb-si` | Aerial | Swin-B | SI | RGB | | `satlaspretrain-aerial-swinb-mi` | Aerial | Swin-B | MI | RGB | ## Usage Processors default to **`do_resize: false`**. Pass tensors or arrays at native resolution; sensor-specific normalization is still applied. ```python from transformers import pipeline import torch model_dir = "satlaspretrain-sentinel2-swinb-si-rgb" pipe = pipeline( task="satlaspretrain-feature-extraction", model=model_dir, trust_remote_code=True, ) # Sentinel-2 RGB at native size, values in [0, 1] x = torch.rand(1, 3, 512, 512) features = pipe(x, pool=True, return_tensors=True) print(features.shape) # Dense feature map tokens = pipe(x, pool=False, return_tensors=True) ``` Opt in to resize using the reference size in `preprocessor_config.json`: ```python features = pipe(x, pool=True, return_tensors=True, image_processor_kwargs={"do_resize": True}) ``` Standard `image-feature-extraction` also works: ```python pipe = pipeline( task="image-feature-extraction", model=model_dir, trust_remote_code=True, ) ``` ## Normalization The bundled image processor applies sensor-specific normalization: - **Sentinel-2 / aerial RGB:** divide by 255 - **Landsat:** `(x - 4000) / 16320`, clipped to [0, 1] See [Normalization.md](https://github.com/allenai/satlas/blob/main/Normalization.md) for details.