Package: opensr-test
A comprehensive benchmark for real-world Sentinel-2 imagery super-resolutionGitHub:https://github.com/ESAOpenSR/opensr-testDocumentation:https://opensr-test.readthedocs.io/PyPI:https://pypi.org/project/opensr-test/Paper: Coming soon!OverviewIn remote sensing, Image Super-Resolution (ISR) goal is to improve the ground sampling distance. However, two problems are common in the literature. Firstly, most models aretested on synthetic data, raising doubts about their real-world applicability and performance. Secondly, traditional evaluation metrics such as PSNR, LPIPS, and SSIM are not designed for assessing ISR performance. These metrics fall short, especially in conditions involving changes in luminance or spatial misalignments - scenarios that are frequently encountered in remote sensing imagery.To address these challenges, 'opensr-test' provides a fresh and fair approach for ISR benchmark. On one front, we providethree datasetsthat were carefully crafted to minimize spatial and spectral misalignment. Besides, 'opensr-test' precisely assesses ISR algorithm performance acrossthree independent metrics groupsthat measurespectral and spatial consistency,the distance between the SR, HR and LR images, andoverall correctness.How to useThe example below shows how to useopensr-testto benchmark your SR model.importtorchimportopensr_testlr=torch.rand(4,64,64)hr=torch.rand(4,256,256)sr=torch.rand(4,256,256)metrics=opensr_test.Metrics()metrics.setup(lr=lr,sr=sr,hr=hr)metrics.compute()metrics.summary()InstallationInstall the latest version from PyPI:pip install opensr-testUpgradeopensr-testby running:pip install -U opensr-testInstall the latest dev version from GitHub by running:pip install git+https://github.com/ESAOpenSR/opensr-testExamplesThe following examples show how to useopensr-testto benchmark your SR model.Useopensr-testwith a custom SR TensorFlow modelUseopensr-testwith a custom PyTorch modelUseopensr-testwith a diffuser modelUseopensr-testto test a multi-image SR model (Satlas Super Resolution)Useopensr-testto create a animated GIF of the SR correctnessVisualizationsTheopensr-testpackage provides a set of visualizations to help you understand the performance of your SR model.importtorchimportopensr_testfromsuper_imageimportHanModelimportmatplotlib.pyplotasplt# Define the SR modelsrmodel=HanModel.from_pretrained('eugenesiow/han',scale=4)# Load the datalr,hr,landuse,parameters=opensr_test.load("spot").values()# Define the benchmark experimentmetrics=opensr_test.Metrics()# Define the image to be testedidx=0lr_img=torch.from_numpy(lr[idx,0:3])hr_img=torch.from_numpy(hr[idx,0:3])sr_img=srmodel(lr_img[None]).squeeze()# Compute the metricsmetrics.setup(lr=lr_img,sr=sr_img,hr=hr_img)metrics.compute()Now, we can visualize the results using theopensr_test.visualizemodule.
fDisplay the triplets LR, SR and HR images:metrics.plot_triplets()Display the quadruplets LR, SR, HR and landuse images:metrics.plot_quadruplets()Display the matching points between the LR and SR images:metrics.plot_spatial_matches()Display a summary of all the metrics:metrics.plot_pixel_summary()Display the correctness of the SR image:metrics.plot_tc()Deeper understandingExplore theAPIsection for more details about personalizing your benchmark experiments.CitationIf you useopensr-testin your research, please cite our paper:Coming soon!AcknowledgementsThis work was make with the support of the European Space Agency (ESA) under the project “Explainable AI: application to trustworthy super-resolution (OpenSR)”. Cesar Aybar acknowledges support by the National Council of Science, Technology, and Technological Innovation (CONCYTEC, Peru) through the “PROYECTOS DE INVESTIGACIÓN BÁSICA – 2023-01” program with contract number PE501083135-2023-PROCIENCIA.