Khoury College of Computer Sciences, Northeastern University, Boston, Massachusetts
This project presents a Data Visualization-Driven Decision Support System for Smart Agriculture — an Android-based platform that integrates artificial intelligence with targeted visual interfaces to empower non-technical farmers with actionable agricultural insights. The system addresses a critical gap in existing precision agriculture tools: while machine learning models for crop disease detection and recommendation have matured significantly, the final step of translating model outputs into comprehensible, farmer-ready visualizations has been largely neglected.
The system comprises three integrated modules: a CNN-based Disease Detection module that renders results as annotated overlay images; a Soil Analysis module that visualizes pH, nitrogen, phosphorus, and potassium readings as color-coded bar charts and trend graphs; and an XGBoost-based Crop Recommendation module trained on 2,200 records across 22 crop types, presenting recommendations as multi-crop visual comparison charts.
Modern agriculture generates vast quantities of data from soil sensors, satellite imagery, weather station feeds, and drone surveys. Despite this abundance of information, the majority of smallholder farmers worldwide continue to rely primarily on manual observation and experiential judgment for critical decisions about planting, irrigation, fertilization, and disease management. Existing agricultural AI platforms predominantly optimize for predictive model accuracy while neglecting the most critical step: translating outputs into insights immediately understandable by non-technical users.
The central novelty is a visualization-first architecture — a design philosophy that treats the visualization layer as a first-class engineering concern rather than an afterthought. Every AI output is explicitly designed for non-technical comprehension, shifting the value proposition from algorithmic accuracy to human usability.
| Parameter | Value |
|---|---|
| Dataset (Crop Recommendation) | 2,200 records, 22 crop types, 7 features (Ingle, 2020) |
| Dataset (Disease Detection) | 87,867 images, 38 classes, 14 species (Hughes & Salathé, 2015) |
| CNN Architecture | MobileNet v1, transfer learning from ImageNet |
| Recommendation Model | XGBoost gradient-boosted classifier |
| Platform | Android Studio + Firebase Realtime Database |
| Target Audience | Non-technical smallholder farmers, agricultural advisors |
The system follows a four-layer architecture pattern separating concerns across data ingestion, AI processing, real-time storage, and visual presentation. This separation enables independent module development while maintaining a unified user experience through the Android frontend.
Each technology was selected based on specific requirements of the deployment context. The following table provides the rationale for each selection.
| Technology | Role | Selection Rationale |
|---|---|---|
| TensorFlow / Keras | CNN training | Industry standard for deep learning. Supports transfer learning and TF.js conversion for browser inference. |
| MobileNet v1 | CNN architecture | Lightweight (depthwise separable convolutions). 8-9x computation reduction vs. VGG/ResNet. Designed for mobile. |
| XGBoost | Crop recommendation | Superior performance on structured tabular data. Sequential error correction outperforms Random Forest. |
| Firebase | Real-time database | Low-latency bidirectional sync. No custom server required. Offline persistence support. |
| Android Studio | Mobile UI | Native camera integration. Offline-capable. Field-deployable on commodity hardware. |
| TensorFlow.js | Browser inference | Client-side CNN inference. No server required. Converted from Keras .h5 via tensorflowjs_converter. |
| Matplotlib / Seaborn | Data visualization | Statistical plotting. Seaborn heatmaps and distribution plots built on Matplotlib. |
| OpenCV | Image processing | Preprocessing, color space conversion, annotated overlay generation. |
| Scikit-learn | ML utilities | Preprocessing pipelines, label encoding, train/test splitting, evaluation metrics. |
| OpenWeatherMap | Weather API | Free-tier real-time weather data by location. Feeds recommendation feature vector. |
| Google Colab | Training environment | Cloud GPU access for CNN training without local hardware requirements. |
Each module follows an independent processing pipeline from data ingestion through AI inference to visual output. The three pipelines share the Firebase storage layer for session persistence and real-time synchronization.
The disease detection module employs MobileNet v1 (Howard et al., 2017) with transfer learning from ImageNet. MobileNet is a lightweight convolutional neural network that replaces standard convolutions with depthwise separable convolutions, reducing computation by approximately 8-9x while maintaining comparable accuracy. This architectural choice is critical for the deployment target: real-time browser-based inference without server infrastructure.
Transfer Learning. Rather than training from scratch, the pre-trained ImageNet weights (14 million images, 1,000 classes) provide sophisticated feature extraction capabilities. The base layers are frozen and a custom classification head is appended for the 38-class plant disease task. This approach requires significantly less training data and computation while achieving high accuracy.
| Parameter | Value |
|---|---|
| Architecture | MobileNet v1 (depthwise separable CNN) |
| Pre-trained weights | ImageNet (14M images, 1,000 classes) |
| Input shape | 224 × 224 × 3 (RGB) |
| Output | 38-class probability vector (softmax) |
| Training images | 70,295 (PlantVillage augmented) |
| Validation images | 17,572 |
| Augmentation | Shear (0.2), zoom (0.2), width/height shift (0.2), rescale (1/255) |
| Optimizer | Adam (adaptive learning rate) |
| Loss function | Categorical cross-entropy |
| Epochs | 6 (EarlyStopping, patience=2) |
| Callbacks | ModelCheckpoint, EarlyStopping, ReduceLROnPlateau |
| Validation accuracy | 85.29% |
| Model size (TF.js) | ~13 MB (4 weight shards + model.json) |
| Inference environment | Client-side browser via TensorFlow.js |
The crop recommendation module employs XGBoost (Chen & Guestrin, 2016), a gradient-boosted decision tree ensemble. Unlike Random Forest, which builds trees independently and averages predictions, XGBoost trains each tree sequentially to correct the residual errors of the previous ensemble. This iterative error-correction mechanism, combined with L1/L2 regularization, produces highly accurate predictions on structured tabular data.
Selection rationale. XGBoost was selected over alternatives based on the dataset characteristics: (1) vs. Random Forest — sequential boosting outperforms independent averaging when feature interactions are complex; (2) vs. Neural Networks — 7 features and 2,200 records do not benefit from deep representation learning; (3) vs. SVM — XGBoost handles multi-class natively and provides feature importance rankings.
| Parameter | Value |
|---|---|
| Algorithm | XGBoost gradient-boosted classifier |
| Dataset | 2,200 records, 22 crop types (Ingle, 2020) |
| Class balance | 100 records per class — perfectly balanced |
| Features | N, P, K, Temperature, Humidity, pH, Rainfall (7 continuous) |
| Output | Ranked crop recommendations with visual comparison |
The soil analysis module applies agronomic domain knowledge through a rule-based threshold comparison engine rather than machine learning. Each crop has established optimal ranges for N, P, K, and pH derived from the dataset. The farmer's measured values are compared against these thresholds to classify nutrient status.
Status classification logic: Optimal (green) when value falls within 70-130% of the crop's ideal level; Deficient (orange) when below 70%; Excess (red) when above 130%. Results are rendered as comparative bar charts with color-coded status indicators, eliminating the need for the farmer to interpret raw numeric values.
| Feature | Type | Unit | Description |
|---|---|---|---|
| N (Nitrogen) | Continuous | mg/kg | Soil nitrogen content; critical for leaf growth and chlorophyll |
| P (Phosphorus) | Continuous | mg/kg | Essential for root development and energy transfer |
| K (Potassium) | Continuous | mg/kg | Vital for fruit quality, disease resistance, water regulation |
| Temperature | Continuous | °C | Average ambient temperature during growing season |
| Humidity | Continuous | % | Relative humidity percentage |
| pH | Continuous | — | Soil acidity/alkalinity (0-14 scale) |
| Rainfall | Continuous | mm | Average rainfall during growing season |
| Label | Categorical | — | Crop type (22 classes, 100 records each) |
P-K Correlation (r = 0.74). The strongest feature correlation observed. Soils with elevated phosphorus consistently contain higher potassium concentrations, a pattern with practical implications for joint fertilization planning. The co-occurrence is explained by similar mineral weathering processes releasing both nutrients simultaneously.
Nitrogen Independence (r = −0.23 with P, r = −0.14 with K). High-nitrogen environments present fundamentally distinct soil profiles from high-PK environments, justifying separate treatment in both the recommendation model and soil analysis visualization.
Humidity-Rainfall Independence (r = 0.09). The near-zero correlation confirms statistical independence between these features, justifying inclusion of both as separate model inputs. Humidity reflects instantaneous atmospheric moisture, while rainfall measures cumulative precipitation over time.
Agro-climatic Clustering. Temperature-rainfall scatter analysis reveals four distinct clusters corresponding to crop categories: Cereals (20-28°C, >175mm rainfall), Fruits (10-44°C, widest range), Legumes (50-150mm moderate rainfall), and Cash Crops (22-30°C central band). These clusters correspond to the XGBoost model's learned decision boundaries.
The defining novelty is the visualization-first architecture: a design philosophy treating the visualization layer as a first-class engineering concern. This contrasts with existing platforms that optimize for prediction accuracy while treating visual output as secondary.
| Dimension | Existing Systems | This System |
|---|---|---|
| Primary focus | Prediction accuracy | Actionable visual insight |
| Target user | Data scientists, agronomists | Non-technical smallholder farmers |
| Output format | Raw labels, probability scores | Charts, annotated images, color-coded dashboards |
| Delivery platform | Web-only / desktop tools | Android mobile — field-usable |
| Module scope | Single-problem tools | Unified Disease + Soil + Crop platform |
| Real-time capability | Batch processing | Firebase-backed real-time synchronization |
The overarching design principle is: Accuracy + Simplicity = Usability. Numbers become color codes, probability scores become annotated images, data tables become side-by-side comparison charts. Every visualization is optimized for both correctness and immediate interpretability by users with limited technical background.
It helps farmers identify crop diseases from leaf photos, assess soil nutrient health, and determine which crops best suit their land — all through visual charts and annotated images rather than raw data.
No. Results use color-coded indicators (green/orange/red) and annotated images. The system is designed specifically for users without technical or data science backgrounds.
The CNN achieves 85.29% validation accuracy across 38 disease classes. Performance varies by disease type and image quality. Best results come from clear, well-lit photographs of individual leaves.
Disease detection covers 14 crop species (38 conditions). Crop recommendation supports 22 types including rice, wheat, cotton, apple, mango, banana, coffee, and various legumes.
Disease detection runs locally (model loaded in browser/device). Soil analysis uses stored thresholds. Firebase synchronization occurs when connectivity is available.
Disease detection runs entirely client-side — images never leave your device. Soil data in Firebase is account-associated and not shared with third parties.
The system compares your soil nutrients and weather conditions against optimal profiles for 22 crops, ranks the best matches, and shows visual comparisons so you can see exactly why each crop was recommended.
MobileNet v1 with ImageNet transfer learning. Depthwise separable convolutions reduce computation ~8-9x, enabling real-time browser inference (~13 MB model) without server infrastructure — essential for the mobile-first target.
Sequential error correction outperforms independent averaging on this 7-feature dataset. XGBoost handles feature interactions natively, includes built-in regularization (L1/L2), and provides interpretable feature importance rankings.
The crop dataset is perfectly balanced: 100 records per class (22 classes, 2,200 total). No resampling, SMOTE, or class weighting was required, eliminating prediction bias.
Pearson analysis: P-K r=0.74 (strong positive), N-P r=−0.23 (negative), Humidity-Rainfall r=0.09 (independent). P-K correlation suggests potential dimensionality reduction, though both are retained for agronomic interpretability.
Each module has a dedicated visualization template. CNN outputs → annotated overlays. XGBoost scores → comparison charts. Threshold results → color-coded bars. Visualization is a first-class component, not post-hoc.
CNN: 85.29% validation accuracy on 17,572 images, monitored via loss curves with EarlyStopping. XGBoost: standard multi-class classification metrics on the balanced 22-class dataset.
Training augmentation: shear (0.2), zoom (0.2), width/height shift (0.2), rescale (1/255). These simulate real-world variance in field photography: angles, distances, and lighting.
| Challenge | Solution |
|---|---|
| AI outputs incomprehensible to farmers | Module-specific visualization templates (overlays, color-coded bars) replacing raw scores |
| Real-time mobile data delivery | Firebase Realtime Database for low-latency synchronization |
| CNN generalization across lighting | Data augmentation (shear, zoom, shift) during training |
| Chart readability for low-literacy users | Color thresholds (green/orange/red) eliminating numeric interpretation |
| Potential class imbalance | Verified balanced distribution (100 records/class) pre-training |