We’re happy to introduce OpenSR-Utils, a lightweight and flexible Python package for applying super-resolution to raw Sentinel-2 imagery using your own PyTorch or PyTorch Lightning models. Whether you’re working with .SAFE
folders straight from Copernicus or standard .tif
files, this utility handles everything from patching and inference to georeferenced output saving—making it easier than ever to apply SR models to real satellite data.
What Can You Do with OpenSR-Utils?
Seamlessly read Sentinel-2
.SAFE
format or custom TIFF imagesApply SR to 10m and 20m bands separately, using different models
Process images in overlapping patches to reduce edge artifacts
Automatically write georeferenced outputs at the original resolution
Support for both
torch.nn.Module
andLightningModule
, with multi-GPU acceleration enabled for the latterIncludes an experimental artifact reduction mode using
eliminate_border_px
andoverlap
parameters
Whether you’re doing large-scale inference, testing custom models, or integrating SR into an operational EO pipeline, OpenSR-Utils simplifies the heavy lifting.
See full usage and examples on GitHub or explore the docs here.
⚠️ Note: Some functionalities like
eliminate_pixel
are still experimental—use with caution. Best results are currently seen withoverlap=40
andeliminate_border_px=20
.
Usage Example
import opensr_utils
from opensr_utils.main import windowed_SR_and_saving
# Create SR Object
file_path = "/yourfilepath/S2A_MSIL2A_20230729T100031_N0509_R122_T33TUG_20230729T134559.SAFE/" # define unzipped folder location of .SAFE format
sr_obj = windowed_SR_and_saving(file_path) # create required class object
# Create Model
from yourmodel import sr_model_10m,sr_model_20m
model_10m = sr_model_10m()
model_20m = sr_model_20m()
# perform windowed SR - 10m
sr_obj.start_super_resolution(band_selection="10m",model=model_10m,forward_call="forward",overlap=20, eliminate_border_px=10)
# perform windowed SR - 20m
sr_obj.start_super_resolution(band_selection="20m",model=model_20m,forward_call="forward",overlap=20, eliminate_border_px=10)

