aaronr43210/duk-feature-extraction
๐ฐ๏ธ DIGITAL UNIVERSITY KERALA FEATURE EXTRACTION MODEL V1 Feature Extraction: Unified AI Pipeline
Developed by Students of Digital University Kerala (DUK)
This repository contains a state-of-the-art AI solution developed for Problem Statement 1: Feature Extraction from Drone Images. Our pipeline is specifically designed to automate the extraction of high-precision geospatial features from DIGITAL UNIVERSITY KERALA FEATURE EXTRACTION MODEL V1 drone orthophotos, achieving a target accuracy of 95%.
๐ Hackathon Solution Overview
Problem Statement: Feature Extraction from Drone Images (DIGITAL UNIVERSITY KERALA FEATURE EXTRACTION MODEL V1 Scheme) Objective: Develop an AI model capable of identifying key features in high-resolution orthophotos with high precision, optimized for efficient processing and deployment.
๐ฏ Key Features Extracted
- Building footprint extraction: High-precision polygonal footprints.
- Roof-top Classification: Automated classification into RCC, Tiled, Tin, and Others.
- Road features: Continuous road network extraction (Polygons & Centerlines).
- Waterbodies: Accurate delineation of ponds and rivers.
- Point Feature Identification: Automated localization of Distribution Transformers and Wells.
๐ง Technical Architecture
1. Foundation Model Backbone
We utilize Segformer-B4 (Mix Transformer) pre-trained on high-resolution ImageNet and Cityscapes datasets as our core feature extractor. Unlike traditional CNNs, this Vision Transformer natively outputs 4 scale-agnostic feature maps, making it the industry standard for complex aerial semantics like "RCC Roof" vs "Tin Roof".
For a detailed breakdown of the model design, see architecture.md.
2. Multi-Head UPerFPN Decoder
Our custom Unified Perceptual Pyramid Network (UPerFPN) fuses the 4 multi-scale features from the Segformer encoder using Bilinear Interpolation and CBAM (Convolutional Block Attention Module) to handle objects of drastically varying sizes.
- Segmentation Heads: Binary masks for Buildings, Roads, and Waterbodies.
- Classification Head: Multi-class branch for Roof Categorization.
- Connectivity Heads: Dilated convolution branches for linear features (roads/pipelines).
- Point Detection: Specialized heads for localized utility features.
3. Advanced Post-Processing Pipeline
Our export module applies research-backed geometric refinement to every extracted feature layer:
- Buildings: PolyMapper-style dominant angle Orthogonalization using SamGeo Feature Edge Reconstruction (FER) for mathematically perfect square/L-shaped structures.
- Roads: Morphological closing (7px kernel) to bridge tree-canopy gaps; hole filling for continuous surfaces.
- All Lines (Centerlines, Utilities):
skan-based skeleton pruning โ Chaikin corner-cutting smoothing โ dead-end snapping for connected networks. - Waterbodies: Large morphological closing (9px) for smooth natural shorelines; convex hull for tiny ponds.
- Point Features: YOLOv8 centroid extraction (no geometric post-processing needed).
5. Security & Production Hardening
- Per-class adaptive confidence thresholds (instead of global 0.5)
- Input file size validation (10 GB limit)
- File extension whitelist validation
- Output filename sanitization (path traversal prevention)
- Pinned dependency versions for reproducible builds
๐ Efficient Processing & Deployment
โก Optimization for Large-Scale Data
- MMSegmentation Patterns: Loss functions utilizing Lovรกsz Hinge and Online Hard Example Mining (Focal Loss) directly optimize IoU over massive orthophotos.
- Intelligent Tiling: 512x512 tiling with 192px overlap to ensure NoData handling and seamless edge reconstruction.
- Negative Sampling Quota: Automatically skips 99% empty tiles (farmland/forest) to focus GPU cycles on feature-rich areas.
๐ป Deployment
A built-in Streamlit Dashboard (app.py) provides:
- One-click processing for GeoTIFF orthophotos.
- Real-time visualization of all 11 feature layers.
- GIS Export: Direct download of vectorized
.gpkg(GeoPackage) datasets ready for QGIS/ArcGIS.
๐ ๏ธ Usage Guidelines
Installation
git clone https://github.com/aaron43210/FEATURE.git
cd FEATURE
pip install -r requirements.txtTraining (Unified Pipeline)
The train.py script unifies the three-stage training process into a single command, automating dataset preparation and multi-model training.
# Train everything (Segmentation + YOLO)
# For 10 villages on DGX (8 GPUs), this takes ~8-12 hours
python train.py --train_dirs ./data/villages/ --epochs 150 --batch_size 8
# EMERGENCY RESUME (If DGX server crashes/restarts)
python train.py --resume --train_dirs ./data/villages/Workflow:
- YOLO Prep: Converts shapefile points to YOLO bounding boxes and image tiles.
- Segmentation: Trains the Segformer+UPerFPN ensemble for buildings, roads, water, and roof types.
- YOLO Train: Trains the YOLOv8 point detector for high-precision utility localization.
For DGX environments, the script automatically leverages all available GPUs via DataParallel/DDP, routing data directly through the HuggingFace Segformer backbone.
Inference
streamlit run app.pyDeveloped with โค๏ธ by Digital University Kerala Students Committed to advancing the DIGITAL UNIVERSITY KERALA FEATURE EXTRACTION MODEL V1 scheme through innovative AI/ML techniques.
