Spaces:
Configuration error
๐ TerraVision
Sharper Earth. Brighter Decisions.
TerraVision is a GIS-based satellite imagery analysis platform that uses Sentinel-2 satellite data and the official ESA OpenSR LDSR-S2 + SEN2SR super-resolution pipeline to generate model-based 2.5 m resolution imagery from freely available Sentinel-2 data.
The platform combines satellite image super-resolution, geospatial processing, spectral analysis, visualization, and GeoTIFF export into a single web-based workflow.
๐ Overview
Sentinel-2 provides freely available multispectral imagery, but its spatial resolution can be limiting for detailed geospatial analysis.
TerraVision addresses this challenge by:
- Selecting a location using latitude/longitude or an interactive map.
- Selecting a date range for Sentinel-2 imagery.
- Retrieving Sentinel-2 L2A data.
- Applying the ESA LDSR-S2 + SEN2SR super-resolution pipeline.
- Generating a model-based 2.5 m resolution, 10-band output.
- Producing multiple GIS analysis layers.
- Providing an original-vs-super-resolved comparison.
- Exporting georeferenced GeoTIFF files and a ZIP containing all outputs.
Important: The 2.5 m imagery generated by TerraVision is a model-based reconstruction. It is not native 2.5 m satellite observation.
โจ Key Features
๐ฐ๏ธ Sentinel-2 Data
- Sentinel-2 L2A imagery
- 10 spectral bands
- User-defined geographical location
- User-defined date range
๐ฌ AI-Based Super Resolution
- ESA OpenSR LDSR-S2 + SEN2SR
- 10 m input
- Model-generated 2.5 m output
- 4ร spatial upscaling
- 10-band super-resolved output
๐บ๏ธ GIS Visualization
TerraVision generates:
- Super-Resolved RGB
- Original Sentinel-2 RGB
- False Color / Infrared
- SWIR Composite
- NDVI
- NDWI
- NDBI
- NBR
- LDSR-S2 Uncertainty
๐ Image Comparison
An interactive before/after comparison allows users to visually compare:
Original Sentinel-2 โ Super-Resolved Output
๐พ Geospatial Export
Users can download:
- Individual GeoTIFF layers
- Complete ZIP package containing all generated layers
All exported layers preserve their geospatial reference information.
๐ง Super-Resolution Pipeline
TerraVision uses the official ESA OpenSR approach combining:
Sentinel-2 L2A
โ
โผ
Data Retrieval
โ
โผ
10-band Sentinel-2 Input
โ
โผ
LDSR-S2 + SEN2SR
โ
โผ
2.5 m Super-Resolved Output
โ
โโโ B02
โโโ B03
โโโ B04
โโโ B05
โโโ B06
โโโ B07
โโโ B08
โโโ B8A
โโโ B11
โโโ B12
โ
โผ
GIS Analysis Layers
The pipeline combines the strengths of:
LDSR-S2
Latent diffusion super-resolution for Sentinel-2 RGB-NIR information.
SEN2SR
Super-resolution processing for the additional Sentinel-2 spectral bands.
Together, they provide the 10-band super-resolved output used by TerraVision.
๐ฐ๏ธ Sentinel-2 Bands
| Band | Description | Resolution |
|---|---|---|
| B02 | Blue | 10 m |
| B03 | Green | 10 m |
| B04 | Red | 10 m |
| B05 | Vegetation Red Edge | 20 m |
| B06 | Vegetation Red Edge | 20 m |
| B07 | Vegetation Red Edge | 20 m |
| B08 | NIR | 10 m |
| B8A | Narrow NIR | 20 m |
| B11 | SWIR 1 | 20 m |
| B12 | SWIR 2 | 20 m |
The super-resolution pipeline produces these bands at the model-generated 2.5 m output scale.
๐ Spectral Analysis
TerraVision converts the super-resolved bands into several commonly used remote-sensing indices.
๐ฑ NDVI
Normalized Difference Vegetation Index
NDVI = (B08 - B04) / (B08 + B04)
Used to analyze vegetation density and vegetation condition.
๐ง NDWI
TerraVision uses the Green-NIR formulation:
NDWI = (B03 - B08) / (B03 + B08)
Used to highlight water-related features.
๐๏ธ NDBI
Normalized Difference Built-up Index
NDBI = (B11 - B08) / (B11 + B08)
Used for identifying built-up and urban areas.
๐ฅ NBR
Normalized Burn Ratio
NBR = (B08 - B12) / (B08 + B12)
Useful for analyzing burn-affected areas and vegetation disturbance.
๐จ Visualization Layers
TerraVision provides several visualization products.
RGB Composite
R = B04
G = B03
B = B02
Provides a natural-color representation.
False Color Composite
R = B08
G = B04
B = B03
Useful for vegetation analysis.
SWIR Composite
R = B12
G = B11
B = B04
Useful for analyzing moisture, soil, built-up areas and burned regions.
๐ Uncertainty Map
TerraVision also exposes the uncertainty estimation available from the underlying LDSR-S2 RGB-NIR component.
The uncertainty map highlights areas where the super-resolution model has greater variation across generated samples.
Dark โ Lower estimated uncertainty
Bright โ Higher estimated uncertainty
Important limitation
This should not be interpreted as a calibrated confidence score for the complete 10-band output.
The current implementation calculates uncertainty from the underlying 4-band LDSR-S2 RGB-NIR model.
๐บ๏ธ TerraVision Workflow
User
โ
โโโ Select Location
โ โโโ Latitude / Longitude
โ
โโโ Select Date Range
โ
โผ
Sentinel-2 L2A Data
โ
โผ
Preprocessing
โ
โผ
ESA LDSR-S2 + SEN2SR
โ
โผ
2.5 m Super-Resolved Imagery
โ
โโโ RGB
โโโ False Color
โโโ SWIR
โโโ NDVI
โโโ NDWI
โโโ NDBI
โโโ NBR
โโโ Uncertainty
โ
โผ
Interactive Visualization
โ
โผ
GeoTIFF / ZIP Export
๐ ๏ธ Technology Stack
Frontend / UI
- Python
- Gradio
- Interactive visualization
- Image comparison slider
- GIS map integration
Machine Learning
- PyTorch
- ESA OpenSR
- LDSR-S2
- SEN2SR
Geospatial Processing
- Rasterio
- Rioxarray
- GeoPandas
- PyProj
- Xarray
- Dask
- Cubo
Satellite Data
- Sentinel-2 L2A
- STAC-based data access
Model / Data Management
- MLSTAC
- Hugging Face ecosystem
Deployment
- Hugging Face Spaces
- Gradio
- ZeroGPU-compatible architecture
๐ฆ Installation
Clone the repository:
git clone https://github.com/prateeksharmacoder-sys/satellite-LDRS-SEN2SR.git
cd TerraVision
Create a virtual environment:
python -m venv venv
Activate it.
Windows
venv\Scripts\activate
Linux / macOS
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
โถ๏ธ Running the Application
Run:
python app.py
The Gradio interface will provide a local web address.
For development, the application can also be launched with:
demo.launch()
๐ Project Structure
TerraVision/
โ
โโโ app.py
โโโ requirements.txt
โโโ README.md
โ
โโโ models/
โ โโโ model configuration / model assets
โ
โโโ utils/
โ โโโ preprocessing.py
โ โโโ visualization.py
โ โโโ geotiff.py
โ โโโ analysis.py
โ
โโโ outputs/
โ โโโ generated products
โ
โโโ assets/
โโโ UI images / project assets
The exact structure may vary depending on the final deployment version.
๐ฌ Technical Implementation
1. Data Retrieval
TerraVision retrieves Sentinel-2 L2A imagery using a STAC-based workflow.
The application requests:
B02
B03
B04
B05
B06
B07
B08
B8A
B11
B12
2. Preprocessing
Sentinel-2 reflectance values are converted into normalized floating-point values before inference.
low_resolution = low_resolution / 10000
3. Super Resolution
The combined model is loaded and executed using SEN2SR:
super_resolution = sen2sr.predict_large(
model=model,
X=low_resolution,
overlap=16
)
The model converts:
10 ร 128 ร 128
into approximately:
10 ร 512 ร 512
4. Spectral Products
The generated bands are used to calculate spectral indices such as:
NDVI = (B08 - B04) / (B08 + B04)
NDWI = (B03 - B08) / (B03 + B08)
NDBI = (B11 - B08) / (B11 + B08)
NBR = (B08 - B12) / (B08 + B12)
5. Geospatial Export
Generated products are exported as GeoTIFF files while preserving:
- CRS
- Spatial transform
- Resolution
- Geographic bounds
The prototype output was verified at:
Resolution: 2.5 m
CRS: EPSG:32630
Output size: 512 ร 512
The exact CRS changes according to the selected geographic location.
๐ฅ Output Files
A typical output package contains:
terravision_layers.zip
โ
โโโ sr_rgb.tif
โโโ false_color.tif
โโโ swir.tif
โโโ ndvi.tif
โโโ ndwi.tif
โโโ ndbi.tif
โโโ nbr.tif
โโโ uncertainty.tif
โก Performance
The current prototype has been successfully tested end-to-end with:
Sentinel-2 input: 10 ร 128 ร 128
Super-resolution: 10 ร 512 ร 512
Output resolution: 2.5 m
Analysis layers: 8
GeoTIFF export: Successful
ZIP generation: Successful
The super-resolution inference is the computationally expensive part of the pipeline.
Uncertainty estimation requires additional inference and is therefore treated as an optional computational component for deployment optimization.
โ ๏ธ Limitations
TerraVision currently has several limitations.
1. Model-Based Resolution
The 2.5 m output is reconstructed by an AI model and is not equivalent to native 2.5 m satellite imagery.
2. Reconstruction Errors
Super-resolution models can introduce artifacts or reconstruct details that are not directly observed in the original imagery.
3. Cloud and Atmospheric Effects
Clouds, haze and poor-quality Sentinel-2 observations can affect the output.
4. Scientific Validation
The current prototype has been technically validated for:
- successful model inference
- correct output dimensions
- spectral layer generation
- GeoTIFF generation
- geospatial referencing
A comprehensive validation against independent high-resolution reference imagery using metrics such as PSNR, SSIM and spectral consistency remains future work.
5. Uncertainty
The current uncertainty output represents the LDSR-S2 RGB-NIR component rather than a calibrated uncertainty estimate for all 10 bands.
6. Temporal Analysis
Change detection such as dNBR requires pre-event and post-event imagery and is not part of the current single-image workflow.
๐ฎ Future Scope
Potential future improvements include:
- Multi-date satellite analysis
- Automated change detection
- dNDVI / dNBR analysis
- Cloud masking
- Larger-area processing
- Batch processing
- More advanced GIS layers
- Scientific validation using higher-resolution reference imagery
- Performance optimization
- GPU acceleration
- Caching of satellite data
- Production-scale deployment
- User accounts and project history
- Export to additional GIS formats
๐ Deployment
TerraVision is designed to be deployed as a Gradio application.
The planned deployment architecture is:
User
โ
โผ
TerraVision Web Interface
โ
โผ
Gradio Application
โ
โโโ Satellite Data Retrieval
โ
โโโ GPU Inference
โ
โโโ Spectral Analysis
โ
โโโ GeoTIFF Generation
โ
โผ
Results + Downloads
The application can be adapted for GPU-backed deployment using Hugging Face Spaces ZeroGPU.
๐งช Validation Status
| Component | Status |
|---|---|
| Sentinel-2 data retrieval | โ Tested |
| 10-band input generation | โ Tested |
| LDSR-S2 + SEN2SR inference | โ Tested |
| 2.5 m output generation | โ Tested |
| RGB generation | โ Tested |
| False Color | โ Tested |
| SWIR | โ Tested |
| NDVI | โ Tested |
| NDWI | โ Tested |
| NDBI | โ Tested |
| NBR | โ Tested |
| LDSR-S2 uncertainty | โ Tested |
| GeoTIFF export | โ Tested |
| Georeferencing | โ Verified |
| ZIP export | โ Tested |
| Interactive web UI | โ Prototype |
| Scientific benchmark validation | ๐ Future work |
| Production-scale deployment | ๐ Planned |
๐ฏ Use Cases
TerraVision can support exploratory analysis in areas such as:
- ๐ฑ Vegetation monitoring
- ๐ง Water-body analysis
- ๐๏ธ Urban expansion studies
- ๐ฅ Burn-area analysis
- ๐พ Agricultural monitoring
- ๐ฐ๏ธ Remote-sensing research
- ๐บ๏ธ GIS analysis
- ๐ Environmental monitoring
๐ Acknowledgements
TerraVision builds upon open-source satellite super-resolution research and software from the European Space Agency (ESA) OpenSR project, including LDSR-S2 and SEN2SR.
The project also uses open geospatial and satellite-data technologies including:
- Sentinel-2
- Cubo
- MLSTAC
- PyTorch
- Rasterio
- Xarray
- Gradio
๐ Disclaimer
TerraVision is a research and demonstration project.
The generated 2.5 m imagery should not automatically be treated as equivalent to native high-resolution satellite imagery. Results may contain model reconstruction artifacts and should be independently validated before being used for critical scientific, commercial, legal, or operational decisions.
๐จโ๐ป Project
TerraVision
Sharper Earth. Brighter Decisions.
Built as a geospatial AI project for exploring the potential of satellite-image super-resolution and GIS analysis.
โญ If you find TerraVision interesting
Consider giving the repository a โญ and exploring the implementation.
### Recommended GitHub repository files
For your current project, I would keep the repository clean like this:
```text
TerraVision/
โ
โโโ README.md โ this file
โโโ app.py โ main Gradio application
โโโ requirements.txt
โโโ .gitignore
โ
โโโ utils/
โ โโโ satellite.py
โ โโโ analysis.py
โ โโโ visualization.py
โ โโโ geotiff.py
โ
โโโ assets/
โโโ screenshots/
One important point: don't upload the ~1.4 GB model file directly into GitHub. Your code can download/load the model from its Hugging Face model repository at runtime.
If you want, I can also create the actual README.md file for you as a downloadable file, ready to put directly into your GitHub repository.