.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/physics/demo_remote_sensing.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note New to DeepInverse? Get started with the basics with the :ref:`5 minute quickstart tutorial `. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_physics_demo_remote_sensing.py: Remote sensing with satellite images ==================================== In this example we demonstrate remote sensing inverse problems for multispectral satellite imaging. These have important applications for image restoration in environmental monitoring, urban planning, disaster recovery etc. We will demonstrate pan-sharpening, i.e., recovering high-resolution multispectral images from measurement pairs of low-resolution multispectral images and high-resolution panchromatic (single-band) images with the forward operator :class:`deepinv.physics.Pansharpen`. We will also demonstrate other inverse problems including compressive spectral imaging and hyperspectral unmixing. We provide a convenient satellite image dataset for pan-sharpening :class:`deepinv.datasets.NBUDataset` provided in the paper :footcite:t:`meng2020large`. which includes data from several satellites such as WorldView satellites. .. tip:: For remote sensing experiments, DeepInverse provides the following classes: - :class:`Pan-sharpening ` - :class:`Compressive spectral imaging ` - :class:`Hyperspectral unmixing ` - :class:`Super resolution ` - :class:`Satellite imagery dataset ` - Metrics for multispectral data: :class:`QNR `, :class:`SpectralAngleMapper `, :class:`ERGAS ` .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: Python import deepinv as dinv import torch device = dinv.utils.get_freer_gpu() if torch.cuda.is_available() else "cpu" .. GENERATED FROM PYTHON SOURCE LINES 38-55 Load raw pan-sharpening measurements ------------------------------------ The dataset includes raw pansharpening measurements containing ``(MS, PAN)`` where ``MS`` are the low-res (4-band) multispectral and ``PAN`` are the high-res panchromatic images. Note there are no ground truth images! .. note:: The pan-sharpening measurements are provided as a :class:`deepinv.utils.TensorList`, since the pan-sharpening physics :class:`deepinv.physics.Pansharpen` is a stacked physics combining :class:`deepinv.physics.Downsampling` and :class:`deepinv.physics.Decolorize`. See the User Guide :ref:`physics_combining` for more information. Note, for plotting purposes we only plot the first 3 bands (RGB). Note also that the linear adjoint must assume the unknown spectral response function (SRF). .. GENERATED FROM PYTHON SOURCE LINES 55-82 .. code-block:: Python DATA_DIR = dinv.utils.get_data_home() dataset = dinv.datasets.NBUDataset(DATA_DIR, return_pan=True, download=True) y = dataset[0].unsqueeze(0).to(device) # MS (1,4,256,256), PAN (1,1,1024,1024) physics = dinv.physics.Pansharpen((4, 1024, 1024), factor=4, device=device) # Pansharpen with classical Brovey method x_hat = physics.A_dagger(y) # shape (1,4,1024,1024) dinv.utils.plot( [ y[0][:, :3], y[1], # Note this will be interpolated to match high-res image size x_hat[:, :3], physics.A_adjoint(y)[:, :3], ], titles=[ "Input MS", "Input PAN", "Pseudo-inverse \n using \n Brovey method", "Linear adjoint", ], dpi=1200, ) .. image-sg:: /auto_examples/physics/images/sphx_glr_demo_remote_sensing_001.png :alt: Input MS, Input PAN, Pseudo-inverse using Brovey method, Linear adjoint :srcset: /auto_examples/physics/images/sphx_glr_demo_remote_sensing_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Downloading datasets/nbu/gaofen-1.zip 0%| | 0/7914941 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_remote_sensing.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_remote_sensing.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_