Explainable multispectral crop-stress detection
An offline engineering laboratory that triages controlled crop-stress patterns from Sentinel-2-like bands and spectral indices while exposing model uncertainty and shift sensitivity.

Project definition
Problem statement
Pigments, leaf water, canopy structure, soil background, crop stage, atmosphere, and sensor processing can change the same broad multispectral bands.
The engineering problem is to separate prepared spectral responses without leaking field-specific patterns, then show confidence and controlled failure instead of presenting a class label as an agronomic diagnosis.
Project objectives
- Define and validate ten Sentinel-2-like surface-reflectance bands.
- Calculate ten interpretable greenness, red-edge, moisture, soil, and senescence indices.
- Generate deterministic wheat and maize observations in independent field groups.
- Compare regularised logistic regression with a random forest on common features.
- Select the model and abstention threshold only on separate calibration fields.
- Measure class performance, probability quality, shift robustness, coverage, and accepted accuracy.
Project structure
Project components
Band schema
Validates B2 through B12 reflectance values, crop, season, growth stage, field group, and latent class.
Spectral engine
Calculates NDVI, NDRE, GNDVI, NDMI, MSI, SAVI, EVI2, CI_RE, PSRI, and VARI with bounded formulas.
Observation generator
Creates structured field, crop, stage, season, canopy, severity, soil, and sensor variation with a fixed seed.
Experiment runner
Keeps complete fields in train, calibration, or test partitions and evaluates both candidate models.
Uncertainty evaluation
Measures calibration, coverage, abstention, and accepted accuracy at a calibration-selected threshold.
Evidence outputs
Writes observations, partitions, metrics, predictions, feature importance, sample explanations, nine figures, and a static dashboard.
Methodology
Project workflow
- 01Generate observations
Create the fixed 5,184-row controlled corpus from 12 independent synthetic fields.
- 02Build spectral evidence
Validate reflectance and calculate all ten indices for every observation.
- 03Separate fields
Assign eight fields to training, two to calibration, and two to final testing without overlap.
- 04Compare models
Fit logistic and random-forest classifiers and select the final model on calibration evidence.
- 05Test uncertainty and shift
Apply reference, sensor-noise, soil-background, red-edge-loss, and combined conditions.
- 06Review retained evidence
Trace headline results to CSV rows, prediction records, explanations, figures, and the offline dashboard.
Demonstration scenario
The command-line experiment rebuilds the 12 synthetic field groups, calculates all 20 features, fits both models, selects the logistic model and 0.92 threshold on calibration fields, then evaluates two unseen fields under five conditions. The student traces one accepted and one abstained prediction to its bands, indices, confidence, feature importance, and retained result row.
Engineering
Tools and method
- Runtime
- Python 3.11 with an installable command-line package and pinned dependencies.
- Numerical work
- NumPy and pandas for deterministic observations, transformations, and retained tables.
- Models
- scikit-learn logistic regression, random forest, metrics, calibration summaries, and permutation importance.
- Visual evidence
- Matplotlib figures and a self-contained local HTML dashboard.
- Documentation
- An 84-page report with labelled figures, tables, literature images, and 50 annotated references.
- Quality controls
- Ruff, 42 tests, 99.36 percent coverage, dependency audit, delivery validator, and a non-root read-only container.
Testing
Evaluation
Evaluation measures
- Reference accuracy: 83.68 percent
- Reference macro F1: 83.41 percent
- Accepted accuracy: 96.54 percent at 56.94 percent coverage
- Combined-shift accuracy: 67.36 percent
- Condition and class recall, log loss, Brier score, and calibration error
- Forty-two automated tests with 99.36 percent statement coverage
Project boundaries
- All retained observations and labels are synthetic and controlled.
- The four classes describe prepared spectral responses and are not confirmed field causes.
- The result does not measure performance on real Sentinel-2 scenes, farms, crops, locations, or years.
- No irrigation, fertiliser, pesticide, disease, yield, or other treatment recommendation is produced.
- A real extension requires official product metadata, quality masks, field measurements, agronomic review, and independent spatial and temporal validation.
- No buyer, student, university, payment, farmer, or field-owner information is collected.
Included
- 01Complete Python source code
- 025,184 controlled observations across 12 field groups
- 03Ten Sentinel-2-like bands and ten documented spectral indices
- 04Logistic and random-forest model comparison
- 05Five controlled conditions with uncertainty-based abstention
- 06CSV and JSON evidence, nine result figures, and offline dashboard
- 0742 automated tests with 99.36 percent statement coverage
- 08Complete source code in a private GitHub repository
- 0984-page project documentation in PDF and editable Word formats
- 1021-page setup and usage guide in PDF and editable Word formats
- 1150 annotated references
Project record
No information is collected on this page.
- Permanent project ID
- GP-DA-0IQOMRW
- Catalogued
- 21 Aug 2026
- Completed
- 25 Aug 2026
- Verified
- 25 Aug 2026
- Demonstration
- Included in repository
Handover
After purchase
- 01Payment is confirmed
The project is marked unavailable and cannot be purchased again.
- 02Repository access is granted
The buyer's submitted GitHub account receives access to the private repository.
- 03The purchase record is delivered
The certification sheet is prepared from the reviewed buyer details and sent privately by email.