Skip to main content

synapse-sr

Observation-consistent super-resolution of Sentinel-2 imagery to a 2 m grid

tests docs PyPI weights python license

Documentation | Quick start | Examples | API


synapse-sr turns a Sentinel-2 L2A scene into a 2.0 m red, green, blue and near-infrared product. The network adds only the structure the 10 m measurement cannot see. Everything the satellite did observe is pinned by a physical model of the instrument and cannot be changed. Every result reports how much of each pixel came from the observation and how much from the learned prior.

RV University, Bengaluru
RV University, Bengaluru. Sentinel-2 L2A 10 m (left) and synapse-sr 2 m (right), 6 February 2025.

Table of contents

Overview

Observation-consistent x_hat = x_base + P_N(delta): the learned correction lives in the null space of the Sentinel-2 forward operator, so re-observing the output reproduces the input
Accountable per-pixel error scale, HIGH / MEDIUM / LOW support classes, validity mask, and a measured round-trip consistency on every result
Direct x5 one network from 10 m to a 2 m grid; the centre sub-pixel sits on the source-pixel centre, and the grid origin is preserved
Geospatial I/O GeoTIFF in, GeoTIFF out; CRS and bounds preserved; any scene size via seamless tiling; NoData and SCL cloud masking
Easy one Python call or one shell command; numpy, torch or xarray inputs; automatic band mapping and radiometric offset; fully offline once the weights are local

Installation

pip install synapse-sr
Extra Adds
pip install "synapse-sr[stac]" fetch_sentinel2 scene download
pip install "synapse-sr[xarray]" xarray input and Result.to_xarray()
pip install "synapse-sr[cuda]" fused mamba-ssm CUDA kernel (optional; must match your PyTorch/CUDA build)

Without the fused kernel, a PyTorch implementation is used. It matches the fused kernel to a relative error of 1.7e-7 and is slower. Run synapse-sr --env to see what is active. Full details: Installation.

Quick start

import synapse_sr

result = synapse_sr.super_resolve("sentinel2_l2a.tif")
result.save("sentinel2_2m.tif")

With an explicit model object:

from synapse_sr import Pro

model = Pro.from_pretrained(device="cuda")        # weights="model.safetensors" for a local file
result = model.super_resolve("sentinel2_l2a.tif")

result.image          # (4, 5H, 5W) reflectance, B04 B03 B02 B08, 2.0 m grid
result.support        # (5H, 5W) 2 HIGH, 1 MEDIUM, 0 LOW / invalid
result.consistency    # {"B04": 0.95, ...} round trip against the input, in noise units

From download to 2 m

from synapse_sr import Pro, fetch_sentinel2       # pip install "synapse-sr[stac]"

scene = fetch_sentinel2(lat=12.9237, lon=77.4987, start="2025-01-01", end="2025-03-15", size_m=2000)
result = Pro.from_pretrained().super_resolve(scene)   # radiometric offset and cloud mask applied automatically

import matplotlib.pyplot as plt
plt.imshow(result.rgb()); plt.axis("off")

Numpy, torch and xarray inputs

model.super_resolve(array)                                   # (C, H, W) DN or reflectance, 10/12/13-band order
model.super_resolve(array, band_names=["B04", "B03", ...])   # any order, by name
model.super_resolve(tensor)                                  # torch.Tensor (C, H, W) or (1, C, H, W)
model.super_resolve(cube.isel(time=0))                       # xarray with a "band" coordinate (cubo, stackstac)

The model uses B04, B03 and B02 (10 m), B08 (10 m), and B05, B06, B07, B8A, B11 and B12 (20 m, as spectral context). See Inputs and preprocessing.

Large scenes

Scenes of any size and shape are tiled with a real-context halo and assembled on the output grid. The output is always exactly 5H x 5W, with no dropped regions. Tiled and single-window results agree to 0.4 % relative RMS.

result = model.super_resolve("large_scene.tif", tile=64, halo=16)

Support, confidence and consistency

result.x_base         # determined by the Sentinel-2 observation
result.prior          # added by the learned prior, invisible to the sensor; x_base + prior == image
result.support        # 2 HIGH (observation-determined), 1 MEDIUM, 0 LOW (prior-dominated) or invalid
result.confidence     # learned per-pixel error scale (raw; use uncertainty() for decisions)
result.valid          # False on NoData, cloud, cloud shadow, cirrus, saturation

See Support, confidence and consistency.

Applications

idx = result.indices()                                   # ndvi savi evi gndvi ndwi (+ ndre ndbi nbr mndwi)
fields = synapse_sr.boundaries(result, "field")          # also "water", "urban"
flood = synapse_sr.change(before, after, "ndwi")         # also "ndvi", "nbr", "brightness"
flood.mask, flood.area_km2, flood.unreliable_fraction

change flags only pixels that are valid and observation-supported on both dates. See Applications for crop monitoring, urban analysis, water mapping and disaster assessment, with benchmarks.

Calibrated uncertainty

err = result.uncertainty()     # expected absolute error per pixel and band (reflectance)
half = result.interval(0.9)    # the HR reference lies within image +/- half with probability 0.9

Pro v2 measured coverage on development patches not used for fitting: 82 / 91 / 96 % at the 80 / 90 / 95 % levels.

Command line

synapse-sr scene.tif scene_2m.tif
synapse-sr scene.tif scene_2m.tif --device cpu --weights synapse-pro-v2.safetensors --scl scene_SCL.tif
synapse-sr --env

The output GeoTIFF has nine bands: B04 B03 B02 B08, ERRSCALE_* for each of the four, and SUPPORT. Use --no-confidence to write the four reflectance bands only.

Offline use

model = Pro.from_pretrained(weights="/opt/models/synapse-pro-v2.safetensors")

No network access is needed apart from an optional one-time weight download, which is verified by SHA-256. See Offline and on-premises use.

Examples

Produced with the package itself (tools/make_gifs.py). Left: Sentinel-2 L2A at 10 m. Right: synapse-sr at 2 m. Each area is 1.28 km x 1.28 km.

RV University, Bengaluru Bengaluru city centre
Ludhiana, Punjab: fields Wayanad, Kerala: landslide-affected hills

More in the Examples section of the documentation.

How it works

x_hat = x_base + P_N(delta)
  • x_base: a Tikhonov-regularised inversion of the Sentinel-2 forward model A. Its per-band weight is set so the residual matches sensor noise.
  • delta: predicted by SynapseProX5, a 14.4 M-parameter network. It has:
    • a state-space (Mamba) backbone;
    • a gated 20 m spectral-context stem;
    • a frequency mixer;
    • a direct x5 PixelShuffle head.
  • P_N = I - A^T (A A^T)^+ A: removes everything the sensor could have observed. A x_hat = A x_base, whatever the network predicts.

Details: How it works.

Limitations

  • Grid spacing is not effective resolution. In the controlled bar-pair test, the v0.1 preview checkpoint does not yet certify pairs at 8 m or finer; the official SEN2SR model certifies 6 m. No effective-resolution figure is claimed for this release.
  • Only red, green, blue and near-infrared are super-resolved. The six 20 m bands are used as context only.
  • Consistency assumes the nominal sensor model and correct geolocation. It degrades with PSF or registration error.
  • The confidence map is not calibrated. The support thresholds are heuristic.
  • The training reference imagery comes from the United States. Other regions are not separately validated.

Full list: Limitations.

Citation

@software{synapse_sr,
  title  = {synapse-sr: observation-consistent super-resolution of Sentinel-2 imagery},
  author = {Naidu, Sharadh},
  year   = {2026},
  url    = {https://github.com/SharadhNaidu/synapse-sr}
}

Acknowledgements

  • The optional fused kernel comes from mamba-ssm (Apache-2.0).
  • Sentinel-2 data: Copernicus programme, European Space Agency.

Release files for synapse-sr 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synapse-sr 0.2.0
File Size Uploaded
synapse_sr-0.2.0.tar.gz 53.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for synapse-sr 0.2.0
File Interpreter ABI Platform
synapse_sr-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 103.6 kB

Release files / synapse_sr-0.2.0.tar.gz

Download URL synapse_sr-0.2.0.tar.gz
Size 53.0 kB
Tags Source
SHA-256 checksum
How to use checksums
90c82914517c48ebbd4a725b51360284adc632f510f23cafadc93b2893026b9b
BLAKE2b-256 checksum
How to use checksums
daa9061ce8de455662657b41c8b0989925ec53311ad3812953e54833f7000fef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / synapse_sr-0.2.0-py3-none-any.whl

Download URL synapse_sr-0.2.0-py3-none-any.whl
Size 50.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d695447394f92eff77360d1ba597042df9dab6033e8ecdf17ac68349815a7e36
BLAKE2b-256 checksum
How to use checksums
ae49b768fda2bdc2bd446f7b62205518e548796e6b3d919896729c268a168e69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page