NAIP Footprint Extraction: U‑Net+Grounding DINO+SAM+Mask R-CNN

Extracting accurate building footprints from high‑resolution NAIP imagery is a common hurdle for GIS analysts, remote‑sensing engineers, and data scientists who need ready‑to‑use vector data for mapping, urban planning, or change detection. The main pain points involve setting up a reliable geospatial deep‑learning environment, downloading and aligning raster tiles with vector labels, preparing training chips, and choosing a model that balances accuracy with computational cost. After training, users often struggle with turning semantic masks into clean, regularized polygons, quantifying performance, and comparing results with zero‑shot or pretrained instance‑segmentation approaches. Scaling the workflow to new areas of interest without repeating the whole setup adds another layer of complexity.

A practical solution follows a end‑to‑end pipeline that can be executed in a single notebook or script. First, install the GeoAI stack and verify GPU availability to accelerate training. Next, download sample NAIP images and building footprints, inspect their CRS, resolution, and statistics, then visualize the labels over the imagery. Create overlapping georeferenced chips (e.g., 512 px with 256 px stride) and matching raster masks using the vector labels, ensuring that empty tiles are handled appropriately. Train a U‑Net with a ResNet‑34 encoder for a modest number of epochs, employing validation split, early stopping, and checkpoint saving to avoid overfitting. Examine training curves to confirm that validation IoU improves and adjust hyperparameters if needed.

Run sliding‑window inference on an unseen NAIP scene to obtain probability and prediction rasters. Post‑process the raw mask by removing small noisy regions, converting to vectors, orthogonalizing, and regularizing footprints to produce orthogonal, analysis‑ready polygons. Compute geometric properties (area, perimeter, solidity) and evaluate the model against rasterized ground truth using IoU and F1 scores and F1 for the building class. Optionally, test zero‑shot segmentation with Grounding DINO and SAM using text prompts like “building” to gauge performance without additional training, and compare with a pretrained Mask R‑CNN instance‑segmentation model to see trade‑offs between merged roofs and individual instances.

Finally, package all outputs—rasters, vectors, plots, and model weights—into a zip file for sharing or downstream use. The same steps can be repeated for any area of interest by pulling NAIP tiles from the Microsoft Planetary Computer and building footprints from Overture Maps, making the workflow scalable and reproducible for large‑scale GeoAI projects.

#AI #GeoAI #RemoteSensing #DeepLearning #GIS #ComputerVision