Hi GRASS GIS Mentors and Community,
My name is Sourish, I am a Computer Science student preparing a proposal for GSoC 2026. I have been exploring the codebase and recently had my first PR merged into main (grass.script: updating core.py with Python type hints - https://github.com/OSGeo/grass/pull/7130 ). I currently have a local development environment set up on Linux, compiled from source, and I’m eager to tackle a larger challenge.
I am very interested in the “Add your research idea to GRASS” category specifically bridging the gap between the GRASS Python API and modern interpretable deep learning workflows.
The Problem:
While deploying deep learning for geospatial analysis (like land cover or infrastructure segmentation) it is becoming standard that these models are often act as “black boxes.” GIS professionals need to trust the predictions, which requires knowing exactly why a model classified a specific pixel as a road or a building. Furthermore, running heavy AI models usually excludes users without dedicated GPUs.
The Proposed Solution:
I am proposing a new Python-based GRASS toolset that integrates PyTorch and ONNX Runtime to perform CPU-friendly, Explainable AI (XAI) segmentation on raster data (GeoTIFFs). The workflow operates as follows:
- Data Ingestion via PyGRASS API Bridge
The tool accepts a user’s raster map and reads it via the native, object-oriented PyGRASS API bridge. By hooking directly into grass.script and the C-backend via Python, the tool maintains full geospatial integrity and metadata consistency throughout the NumPy conversion process, ensuring that every AI prediction remains georeferenced to the real world. - Tiling Engine — Memory-Safe Chunking
A custom Tiling Engine prevents memory overflow by avoiding the loading of entire giga-pixel satellite scenes into RAM. Instead, it processes data as discrete chips (e.g., 256×256 pixels), allowing for high-resolution inference even on standard consumer hardware with limited memory. Each chip is then normalised (pixel values scaled from 0–255 to 0–1) before inference.
3. ONNX Inference Path — CPU-Optimised Segmentation
Each normalised tile is passed through a pre-trained segmentation model (e.g., a hybrid CNN-Transformer) using ONNX Runtime for optimised CPU inference. This path produces a predicted Segmentation Mask per tile to identify geographic features such as roads, buildings, and land cover classes.
4. PyTorch Grad-CAM Path — Explainability (Independent from ONNX)
In a separate parallel process the same tile is passed through the equivalent PyTorch model. A Grad-CAM (Gradient-weighted Class Activation Mapping) Hook captures gradients at the final convolutional layer to generate a spatial Explainability Heatmap. Note: Grad-CAM requires access to the intermediate layer gradients which ONNX Runtime does not expose. Therefore, the XAI path runs exclusively via PyTorch while ONNX handles optimised CPU inference independently. This heatmap provides visual evidence for each segmentation decision allowing users to verify that the model is responding to relevant geographic features rather than noise or artifacts.
5. Reassembly & Geospatial Export
The per-tile Segmentation Masks and Explainability Heatmaps are stitched back into full-resolution images. Using PyGRASS the final outputs are written back into the GRASS GIS database as two distinct map layers with full OGC-compliant coordinate reference system (CRS) metadata preserved end-to-end from input GeoTIFF to final GRASS raster layer.
Why Me?
My academic background focuses heavily on deep learning architectures specifically utilizing hybrid CNN-Transformers and Explainable AI techniques (Grad-CAM) for complex high-stakes image segmentation. Combined with my full-stack experience in Python and C, I am confident I can build a clean, optimized bridge between these ML frameworks and the GRASS database.
I would love to hear your thoughts on this direction. Is this a feature the community would find valuable? Are there specific pre-trained models or segmentation targets (e.g., roads, agriculture) the core team would prefer this tool to be optimized for?
Looking forward to your feedback
Best regards,
Sourish Dutta Sharma
[https://github.com/Sourish-spc]