sen-bridge / README.md
nikhilr01's picture
Card: tag v0.1.2 and link the .npy release
86f3492 verified
|
Raw History Blame Contribute Delete
13.8 kB
metadata
license: cc-by-4.0
pretty_name: SEN-Bridge
task_categories:
  - image-to-image
tags:
  - remote-sensing
  - sentinel-1
  - sentinel-2
  - sar
  - flow-matching
  - image-to-image
size_categories:
  - 100K<n<1M
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
      - split: validation
        path: data/validation-*
      - split: test
        path: data/test-*
dataset_info:
  features:
    - name: id
      dtype: string
    - name: split
      dtype: string
    - name: cluster_id
      dtype: int32
    - name: region
      dtype: string
    - name: sar
      dtype: image
    - name: optical
      dtype: image
    - name: meta
      list: float32
      length: 7
    - name: orbit
      dtype:
        class_label:
          names:
            '0': asc
            '1': desc
    - name: lat
      dtype: float32
    - name: lon
      dtype: float32
    - name: crs
      dtype: int32
    - name: t_radar
      dtype: timestamp[s, tz=UTC]
    - name: t_optical
      dtype: timestamp[s, tz=UTC]
    - name: dt_hours
      dtype: float32
    - name: doy
      dtype: int32
    - name: slope_std
      dtype: float32
    - name: elev_mean
      dtype: float32
    - name: water_frac_sar
      dtype: float32
    - name: water_frac_opt
      dtype: float32
    - name: vh_noise_frac
      dtype: float32
    - name: snow_score
      dtype: float32
    - name: haze_score
      dtype: float32
    - name: cloud_frac
      dtype: float32
    - name: rfi_score
      dtype: float32
    - name: flat_bright
      dtype: bool
    - name: clean
      dtype: bool
    - name: lulc_bare
      dtype: float32
    - name: lulc_rangeland
      dtype: float32
    - name: lulc_water
      dtype: float32
  splits:
    - name: train
      num_bytes: 8972388947
      num_examples: 125000
    - name: validation
      num_bytes: 1075905174
      num_examples: 15000
    - name: test
      num_bytes: 2147185148
      num_examples: 30000

SEN-Bridge

Paired Sentinel-1 radar and Sentinel-2 optical image crops (128x128, 20 m/pixel) for benchmarking flow-matching and bridge models on radar-to-optical translation. Real sensor coupling, no synthetic degradation.

  • Examples: 170,000 (125,000 train / 15,000 validation / 30,000 test).
  • Task: sample the optical image given the radar image and metadata (meta: season, location, time gap, orbit).
  • Images: 8-bit PNG. sar is R=VV, G=VH, B=VV-VH; optical is RGB (B4, B3, B2). Model input: x / 127.5 - 1.
  • Subsets by flag, not config: ds.filter(lambda r: r["clean"]), or abs(dt_hours) <= 24.
  • Evaluation: scripts/evaluate.py and the sen-bridge metrics (FID, LPIPS, PSNR, SSIM); real-target FID statistics are in stats/.
  • Code: the installable sen-bridge package is at https://github.com/nikhilr612/sen-bridge (tag v0.1.2); scripts/ here is a reference snapshot. Install with uv add "sen-bridge[torch] @ git+https://github.com/nikhilr612/sen-bridge@v0.1.2".
  • Fast random access: an optional copy as memory-mappable .npy files is at https://huggingface.co/datasets/nikhilr01/sen-bridge-npy, read with sen_bridge.data (pixels identical to this release).

Provenance

Derived from SSL4EO-S12 v1.1 (embed2scale/SSL4EO-S12-v1.1, Hugging Face commit 97a91733db962222e1e6b40a836845ddbbb16b86), CC BY 4.0. Only the train split of the source was used. Build code commit: 605c95ec49b303d5136402b1207003dcbdaca070 (see scripts/build/); seed 0. Threshold snapshot SHA-256: be1167553d9c52015afe5362a53791b70edfd66aa01b61ec834802f34d583eb4.

Attribution. Contains modified Copernicus Sentinel data 2019-2021. Please also cite SSL4EO-S12 v1.1.

Preprocessing (model-free, nothing stretched per image)

Centre-crop 264 to 256; 2x2 average to 128x128 (radar averaged in linear power, then back to dB). Radar channels are clipped to VV [-25, 0] dB, VH [-32, -5] dB and VV-VH [0, 15] dB and mapped to 0..255. Optical reflectance = DN/10000, clipped to [0, 0.3], gamma 1/2.2, mapped to 0..255. Inverse mappings are in scripts/sen_bridge_build/preprocess.py.

Filters and yield

Candidates were location-seasons with |t_optical - t_radar| <= 48 h, outside local winter at |lat| > 40, and SSL4EO cloud cover <= 5%. Of 255,929 fetched, 204,770 passed the image filters. Rejected IDs are in rejects/rejects.parquet.

Rejected by Count
steep 19,171
cloud_shadow 11,893
featureless_arid 6,257
elevation 5,754
overexposed 3,949
water_mismatch 1,938
cloud_opaque 974
too_dark 899
saturated 289
invalid_pixels 35

Radio-frequency interference and radar border noise are recorded (rfi_score) but are not filters: the audit found them to reject almost only good pairs.

All constants (frozen in docs/thresholds.json):

Constant Value
CROP 256
SIZE 128
SAR_CLIPS [[-25.0, 0.0], [-32.0, -5.0], [0.0, 15.0]]
OPT_MAX 0.3
OPT_GAMMA 0.45454545454545453
S2_SCALE 10000.0
MAX_DT_HOURS 48.0
CLOUD_MAX_FRAC 0.05
CLOUD_RULE_REJECT 0.5
SAT_MAX_FRAC 0.01
WHITE_MAX_FRAC 0.4
WHITE_FLAT_STD 0.03
DARK_MEAN_MIN 0.08
FLAT_BRIGHT_MEAN 0.88
ARID_LULC_MIN 0.5
WATER_MISMATCH 0.3
LULC_WATER_MIN 0.05
SLOPE_STD_MAX 8.0
ELEV_MAX_M 2000.0
SNOW_LAT 40.0
BORDER_DB -35.0
WATER_DB -18.0
NOISE_FLOOR_DB -28.0
WATER_CROP_FRAC 0.9
WATER_SPLIT_CAP 0.1
BARE_SPLIT_CAP 0.08
BARE_CROP_FRAC 0.5
SPLIT_MIN_DIST_KM 5.0
CLEAN_MIN_STD 0.05
CLEAN_WATER_OPT 0.9
CLEAN_WATER_LULC 0.5
CLEAN_MEAN_RANGE [0.1, 0.8]
LAT_BAND_EDGES [20, 30, 40, 50]

Splits

Whole 1x1-degree cells (a stand-in for SSL4EO's seed-city clusters, which are not shipped) go to one split. Within each region, hemisphere and latitude band (0-20, 20-30, 30-40, 40-50 and 50+ degrees, a climate stand-in), cells are drawn at random for test, then validation, until each holds its share of that stratum's rows (a quota in rows, not cells, because cells differ in size), and the rest are train. The test set is then chosen first (30,000 crops), every validation and train crop within 5 km of it is dropped, validation is chosen next (15,000 crops) and train crops within 5 km of it are dropped, and train is chosen last. Each split is sampled to match the dataset's mix of region, hemisphere and latitude band, so the test set's size and composition never depend on the other splits and no crop in one split is within 5 km of a crop in another. Crops that are over 90% water and crops that are at least 50% bare ground are capped at 10% and 8% of every split, exactly. Compute FID against the test targets only, and select checkpoints on validation.

Quality: what was checked

Three blind audit rounds on this pipeline's pilot (single reviewer, Claude; labels in docs/audit/). After retuning, the clearly-bad rate among kept pairs was about 1-2% (n=120-150 per round, 95% CI up to about 6%); counting low-confidence calls it was 7-10%, almost all thin haze or washed-out optical. The clean flag (neural cloud mask exactly zero, textured optical or confirmed open water, mean luminance 0.10-0.80) covers 65% of examples with about 2% low-confidence-bad and no clearly bad pair in 297 audited. clean is biased toward vegetated and built scenes. The estimated effect of all filters on the clearly-bad rate is about 2.0% to 1.1%.

Known limitations

  • Thin haze, small clouds (under 5% of a crop) and pale featureless land remain in some examples; no cheap rule separates them from valid scenes. Use haze_score, flat_bright and clean.
  • Featureless bright arid crops were excluded, so deserts are under-represented relative to the source.
  • Radar is not terrain-corrected: crops with slope std above 8 degrees are excluded (radar-optical shifts exceeded 3 px for 35-50% of crops above 6 degrees), but residual shifts of about 1 px (20 m) remain.
  • Intertidal zones are not excluded by a tide model. A radar-versus-optical water-mismatch filter removes about 0.7% of crops. Radar water (VV < -18 dB) misses wind-roughened water; use water_frac_opt.
  • orbit is derived from the local solar time of the radar pass (the source has no orbit field). t_radar and t_optical are assumed UTC.
  • Pairs are near-simultaneous (48 h or less), not simultaneous; tides, wind and dew can differ. Near cities, 2019-2021, low relief outside the snow season.
  • SSL4EO's neural cloud mask and land-cover layer were used for filtering and for the lulc_* flags only, never for pairing.
  • LPIPS uses the VGG16 trunk, whose weights have no published licence; see docs/LICENSES.md before commercial use.

License and attribution

  • Data: CC BY 4.0 (LICENSE; https://creativecommons.org/licenses/by/4.0/), the licence of its source. Credit SSL4EO-S12 v1.1 and give the notice below.
  • Code in scripts/ (build code, metrics, evaluation): Apache-2.0 (scripts/LICENSE); third-party licences are in licenses/ and NOTICE.
  • Required notice: Contains modified Copernicus Sentinel data 2019-2021.
  • Changes made to the source data: centre-crop to 256x256 and 2x2 averaging to 128x128 at 20 m (radar in linear power); 8-bit normalisation of radar and optical; rejection of crops by the filters above; selection and splitting; added metadata (meta, orbit derived from the radar pass's local solar time, quality scores and flags).

Release policy

Fixes ship as new tagged revisions with a changelog; v1.0 is never overwritten. Test targets are public; select models on validation only. Citation/DOI: 10.57967/hf/11204 (minted by the Hub).

Loading the dataset

With 🤗 Datasets, images decode to PIL. lat, lon, dt_hours and the quality flags are plain columns, meta is a list of 7 float32 values and orbit is a class label (0 = ascending, 1 = descending):

from datasets import load_dataset

ds = load_dataset("nikhilr01/sen-bridge", split="validation")  # or "train", "test"
row = ds[0]
sar, optical = row["sar"], row["optical"]  # 128x128 RGB PIL images, 8-bit
meta = row["meta"]  # conditioning vector, see below

meta is (sin doy, cos doy, x, y, z, dt / 48 h, orbit): the season as a point on a circle, the unit vector (x, y, z) of the location, the radar-to-optical time gap scaled by 48 h, and the orbit as +1 (descending) or -1 (ascending).

The images are fixed-range 8-bit, so the only preprocessing a model needs is scaling to float, for example np.asarray(im, np.float32) / 127.5 - 1. The first load_dataset call downloads and prepares all splits (about 12 GB of disk, even with split=); add streaming=True to avoid that (iteration only, no random access).

With Grain (tested with Grain 0.2.18). Grain starts worker processes by spawning, so the script needs the __main__ guard, and the source reloads the dataset in each worker instead of pickling it. Build the source in the parent first, as main does, so the workers open a warm cache:

import grain
import numpy as np
from datasets import load_dataset

REPO = "nikhilr01/sen-bridge"


def to_float(image):
    return np.asarray(image.convert("RGB"), np.float32) / 127.5 - 1


class Pairs:
    """Random-access source of (radar, optical, metadata) examples."""

    def __init__(self, split):
        self.split = split
        self.ds = load_dataset(REPO, split=split)

    def __len__(self):
        return len(self.ds)

    def __getitem__(self, i):
        row = self.ds[int(i)]
        return {
            "sar": to_float(row["sar"]),  # [128, 128, 3] in [-1, 1]
            "optical": to_float(row["optical"]),  # [128, 128, 3] in [-1, 1]
            "meta": np.asarray(row["meta"], np.float32),  # [7]
        }

    def __getstate__(self):  # do not pickle the dataset into workers
        return {"split": self.split}

    def __setstate__(self, state):
        self.__init__(state["split"])


def main():
    source = Pairs("validation")
    loader = grain.DataLoader(
        data_source=source,
        sampler=grain.samplers.IndexSampler(
            len(source),
            shuffle=True,
            seed=0,
            shard_options=grain.sharding.NoSharding(),
            num_epochs=1,
        ),
        operations=[grain.transforms.Batch(batch_size=64, drop_remainder=True)],
        worker_count=4,
    )
    for batch in loader:
        print({k: v.shape for k, v in batch.items()})  # sar, optical, meta
        break


if __name__ == "__main__":
    main()

In one local run with 4 workers this gave about 1,000 pairs/s; your speed depends on disk, cache and CPU. The Grain calls above are version-sensitive.

Citation

@misc{raghavendra2026senbridge,
  title  = {{SEN-Bridge}: A SAR-to-Optical Flow Matching Dataset},
  author = {Raghavendra, Nikhil},
  year   = {2026},
  doi    = {10.57967/hf/11204},
  url    = {https://huggingface.co/datasets/nikhilr01/sen-bridge}
}
@article{blumenstiel2025ssl4eos12v11,
  title   = {{SSL4EO-S12 v1.1}: A Multimodal, Multiseasonal Dataset for
             Pretraining, Updated},
  author  = {Blumenstiel, Benedikt and Ait Ali Braham, Nassim and
             Albrecht, Conrad M and Maurogiovanni, Stefano and Fraccaro, Paolo},
  journal = {arXiv preprint arXiv:2503.00168},
  year    = {2025}
}
@article{wang2022ssl4eos12,
  title   = {{SSL4EO-S12}: A Large-Scale Multi-Modal, Multi-Temporal Dataset for
             Self-Supervised Learning in Earth Observation},
  author  = {Wang, Yi and Ait Ali Braham, Nassim and Xiong, Zhitong and
             Liu, Chenying and Albrecht, Conrad M and Zhu, Xiao Xiang},
  journal = {arXiv preprint arXiv:2211.07044},
  year    = {2022}
}