Multispectral UAV Crop Classification Pipeline
End-to-end ML pipeline for temporal crop classification using 10-band UAV orthophotos. Built rigorous spatial zone-based data splits to prevent leakage, engineered 220 spectral features, and solved overfitting through PCA dimensionality reduction—achieving 0.96 F1-score with just 9 components.

Gallery
Problem
Automated harvest machinery requires precise crop type classification for routing and equipment configuration. Manual field surveys are labor-intensive and delay logistics. Multispectral UAV imagery offers scalable automation, but temporal data across multiple flights creates complex ML challenges: (1) high-dimensional feature spaces (10 bands × temporal epochs), (2) spatial autocorrelation causing data leakage if train/test splits ignore geographic proximity, and (3) real-world label noise from harvest timing mismatches (early-harvested wheat appears as bare soil in later flights).
Approach
Built production-grade classical ML pipeline with three specialized components: (1) Data Engineering—processed 10 temporal orthophotos (10 spectral bands each, 3cm resolution) into 63,650 spatially-indexed 64×64 image patches using 50% overlap stride for texture context. Implemented strict geographical zone-based splitting (4 distinct physical zones assigned to Train/Val/Test) to prevent spatial data leakage from overlapping patches—ensuring models never saw the same ground location across splits. (2) Feature Engineering—extracted statistical descriptors (mean, std, entropy) and calculated vegetation indices (NDVI, GNDVI, Red-Edge NDVI) across all temporal layers, yielding 220 raw features per patch. (3) Dimensionality Reduction—initial Random Forest with feature selection showed severe overfitting (large Train/Val vs. Test accuracy gap). Solved this by applying Principal Component Analysis (PCA): retained just 9 components capturing 95% variance, which reduced Out-Of-Bag to Test accuracy gap to only 0.03 while maintaining discriminative power.
Data
10 temporal multispectral orthophotos from agricultural research site, each with 10 bands (visible + NIR + red-edge), 3cm spatial resolution. Generated 63,650 patches (64×64 pixels with 50% overlap) labeled with 6 crop classes. Spatial metadata preserved for zone assignment: Zone 1 (40% Train), Zone 2 (20% Train), Zone 3 (20% Val), Zone 4 (20% Test). Temporal coverage spans critical phenological stages (emergence through senescence) to capture spectral dynamics. Ground-truth labels from farmer records and field surveys, with ~5% label noise from early-harvest mismatches.
Validation
Spatially-aware cross-validation using geographic zone splits (not random splits) to accurately measure generalization to unseen field areas. Evaluated using confusion matrix, per-class precision/recall, F1-score, and Out-Of-Bag (OOB) vs. Test accuracy gap as overfitting metric. Tested model robustness against label noise by analyzing misclassifications on early-harvested wheat plots (expected failure mode). Compared feature selection vs. PCA: PCA-based model showed dramatically tighter OOB/Test concordance (gap reduced from 0.12 to 0.03), proving superior generalization.
Results
PCA + Random Forest pipeline achieved 0.96 F1-score on held-out test zone with exceptional generalization stability (OOB-Test gap of only 0.03). PCA dimensionality reduction from 220 features to 9 components eliminated overfitting while preserving 95% variance—confirming spectral redundancy across bands and temporal layers. Model proved highly resilient to real-world label noise: correctly flagged early-harvested wheat as bare soil rather than overfitting to erroneous labels. Key architectural insight: geographic zone-based splitting is non-negotiable for spatial data—random splits inflate accuracy by 8-12% due to spatial autocorrelation. Classical ML (Random Forest + PCA) matched or exceeded baseline deep learning CNN performance while requiring 10× less training time and providing feature interpretability through variance explained analysis.
My Role
Machine Learning Engineer. Architected and implemented complete classical ML pipeline: designed spatial zone-based splitting logic to prevent data leakage, engineered 220-feature spectral index suite, diagnosed overfitting through OOB/Test gap analysis, implemented PCA solution achieving 0.96 F1-score, and led comparative evaluation against deep learning baseline demonstrating classical ML viability for production deployment.
Next Steps
Extend to multi-season generalization (train on 2023, test on 2024 imagery). Implement SHAP interpretability analysis to identify which spectral bands and vegetation indices drive classification decisions. Add confidence thresholding for reject option (flag ambiguous patches for manual review). Deploy as FastAPI microservice for integration with harvest route optimization software. Investigate ensemble with deep learning for edge cases where classical ML fails (highly mixed pixels at field boundaries).
Key Outcomes
- 0.96 F1-score with PCA + Random Forest
- 63,650 spatially-indexed patches (geographic zone splits)
- Solved overfitting: OOB-Test gap reduced from 0.12 → 0.03
- 220 → 9 features via PCA (95% variance retained)
- Robust to label noise (early-harvest scenarios)