A Data Visualization-Driven Decision Support System for Smart Agriculture

Karuniya Premnath

Khoury College of Computer Sciences, Northeastern University, Boston, Massachusetts

EECE 5642 — Data Visualization — April 2026

1. Project Overview

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.

1.1 Problem Statement

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.

1.2 Solution Approach

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.

Table 1. System Summary
ParameterValue
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 ArchitectureMobileNet v1, transfer learning from ImageNet
Recommendation ModelXGBoost gradient-boosted classifier
PlatformAndroid Studio + Firebase Realtime Database
Target AudienceNon-technical smallholder farmers, agricultural advisors

2. System Architecture

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.

Presentation Layer
Android Application
Android Studio. Native mobile interface for field-usable access to all visualization modules. Chosen for offline capability and camera integration.
Disease Detection UI
Annotated Overlay. CNN results rendered as colored overlays on original leaf images with disease label and confidence indicator.
Soil Analysis UI
Color-Coded Charts. NPK/pH values as bars against crop thresholds. Green = optimal, Orange = deficient, Red = excess.
Crop Recommendation UI
Comparison Charts. Multi-crop visual comparison of farmer's values vs. ideal crop profiles.
▼ ▼ ▼
Storage Layer
Firebase Realtime Database
Real-time Sync. Low-latency bidirectional synchronization. Supports live chart updates and offline persistence.
Session History
Trend Tracking. Successive soil readings stored for trend visualization across growing seasons.
▼ ▼ ▼
Processing Layer
CNN Pipeline (MobileNet)
Disease Classification. Transfer learning model. Preprocessing (224x224, normalize) + inference + overlay generation.
XGBoost Classifier
Crop Ranking. Gradient-boosted ensemble on 7-feature input. Ranks 22 crop types by suitability.
Threshold Engine
Soil Status. Rule-based comparison against crop-specific optimal ranges. Outputs status codes.
▼ ▼ ▼
Data Layer
PlantVillage
Disease Images. Hughes & Salathé (2015). 87,867 images, 38 classes, 14 crop species.
Kaggle Dataset
Crop Data. Ingle (2020). 2,200 records, 22 crops, balanced at 100 records/class.
OpenWeatherMap
Weather API. Real-time temperature, humidity, rainfall by location.
IoT Sensors
Future. Planned real-time soil sensor integration via Firebase.

3. Technology Stack

Each technology was selected based on specific requirements of the deployment context. The following table provides the rationale for each selection.

Table 2. Tools and Technologies Used
TechnologyRoleSelection Rationale
TensorFlow / KerasCNN trainingIndustry standard for deep learning. Supports transfer learning and TF.js conversion for browser inference.
MobileNet v1CNN architectureLightweight (depthwise separable convolutions). 8-9x computation reduction vs. VGG/ResNet. Designed for mobile.
XGBoostCrop recommendationSuperior performance on structured tabular data. Sequential error correction outperforms Random Forest.
FirebaseReal-time databaseLow-latency bidirectional sync. No custom server required. Offline persistence support.
Android StudioMobile UINative camera integration. Offline-capable. Field-deployable on commodity hardware.
TensorFlow.jsBrowser inferenceClient-side CNN inference. No server required. Converted from Keras .h5 via tensorflowjs_converter.
Matplotlib / SeabornData visualizationStatistical plotting. Seaborn heatmaps and distribution plots built on Matplotlib.
OpenCVImage processingPreprocessing, color space conversion, annotated overlay generation.
Scikit-learnML utilitiesPreprocessing pipelines, label encoding, train/test splitting, evaluation metrics.
OpenWeatherMapWeather APIFree-tier real-time weather data by location. Feeds recommendation feature vector.
Google ColabTraining environmentCloud GPU access for CNN training without local hardware requirements.

4. Workflow Pipeline

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.

Disease Detection Pipeline
Leaf Image Capture
Resize (224x224)
Normalize (0-1)
MobileNet Inference
Softmax Output
Annotated Overlay
Result Display
Soil Analysis Pipeline
Manual / IoT Input
Firebase Sync
Threshold Compare
Status Classify
Color-Coded Bars
Trend Graph
Result Display
Crop Recommendation Pipeline
Soil + Weather Input
Feature Vector [7]
XGBoost Ranking
Top Crops
Comparison Chart
Result Display

5. Model Architecture and Training

5.1 Disease Detection — MobileNet CNN

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.

Frozen — Pre-trained Weights
MobileNet Base (ImageNet)
14M images, 1,000 classes. Depthwise separable convolution layers.
Feature extraction: edges, textures, shapes, spatial patterns.
▼
Trainable — Custom Classification Head
GlobalAveragePooling2D → Dropout(0.2) → Dense(38, softmax)
Spatial compression → regularization (20% dropout) → 38-class probability vector.
Table 3. CNN Training Configuration and Results
ParameterValue
ArchitectureMobileNet v1 (depthwise separable CNN)
Pre-trained weightsImageNet (14M images, 1,000 classes)
Input shape224 × 224 × 3 (RGB)
Output38-class probability vector (softmax)
Training images70,295 (PlantVillage augmented)
Validation images17,572
AugmentationShear (0.2), zoom (0.2), width/height shift (0.2), rescale (1/255)
OptimizerAdam (adaptive learning rate)
Loss functionCategorical cross-entropy
Epochs6 (EarlyStopping, patience=2)
CallbacksModelCheckpoint, EarlyStopping, ReduceLROnPlateau
Validation accuracy85.29%
Model size (TF.js)~13 MB (4 weight shards + model.json)
Inference environmentClient-side browser via TensorFlow.js

5.2 Crop Recommendation — XGBoost

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.

Input
Feature Vector [N, P, K, Temperature, Humidity, pH, Rainfall]
▼
Sequential Boosting
Tree1 → Tree2 → ... → TreeN
Each tree corrects residual errors from the previous ensemble.
Gradient descent minimizes loss at each iteration.
▼
Output
Ranked crop suitability scores (22 classes)
Table 4. Crop Recommendation Model Details
ParameterValue
AlgorithmXGBoost gradient-boosted classifier
Dataset2,200 records, 22 crop types (Ingle, 2020)
Class balance100 records per class — perfectly balanced
FeaturesN, P, K, Temperature, Humidity, pH, Rainfall (7 continuous)
OutputRanked crop recommendations with visual comparison

5.3 Soil Analysis — Threshold Engine

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.

6. Dataset Analysis and Findings

Table 5. Dataset Feature Descriptions
FeatureTypeUnitDescription
N (Nitrogen)Continuousmg/kgSoil nitrogen content; critical for leaf growth and chlorophyll
P (Phosphorus)Continuousmg/kgEssential for root development and energy transfer
K (Potassium)Continuousmg/kgVital for fruit quality, disease resistance, water regulation
TemperatureContinuous°CAverage ambient temperature during growing season
HumidityContinuous%Relative humidity percentage
pHContinuous—Soil acidity/alkalinity (0-14 scale)
RainfallContinuousmmAverage rainfall during growing season
LabelCategorical—Crop type (22 classes, 100 records each)

6.1 Key Statistical Findings

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.

7. Novelty of the Work

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.

Table 6. Comparison with Existing Agricultural AI Systems
DimensionExisting SystemsThis System
Primary focusPrediction accuracyActionable visual insight
Target userData scientists, agronomistsNon-technical smallholder farmers
Output formatRaw labels, probability scoresCharts, annotated images, color-coded dashboards
Delivery platformWeb-only / desktop toolsAndroid mobile — field-usable
Module scopeSingle-problem toolsUnified Disease + Soil + Crop platform
Real-time capabilityBatch processingFirebase-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.

8. Use Cases

UC-1: Field Disease Identification
A farmer photographs a symptomatic tomato leaf. The CNN detects Late Blight at 91% confidence, overlays the affected region, and provides treatment recommendations — within seconds on a mobile device.
Disease Detection Module
UC-2: Pre-planting Soil Assessment
A farmer enters NPK and pH readings for a cotton field. The system renders color-coded bars: nitrogen optimal (green), potassium excess (red). Immediate visual feedback eliminates numerical interpretation.
Soil Analysis Module
UC-3: Crop Selection for New Land
A first-time farmer inputs soil and weather conditions. The system ranks 22 crops by suitability with side-by-side comparison charts showing feature-level alignment between actual and ideal conditions.
Crop Recommendation Module
UC-4: Multi-farm Remote Advisory
An agricultural advisor monitors soil trends from connected farms via Firebase sync. Nutrient trajectory graphs enable seasonal health tracking without on-site visits.
All Modules (Firebase)
UC-5: Regional Agro-climatic Research
A researcher uses dataset visualizations to analyze NPK profiles, correlation structures, and temperature-rainfall clustering patterns across 22 crop types for publication and policy recommendations.
Dataset Visualizations

9. Frequently Asked Questions

General Audience

What does this application do?

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.

Is technical knowledge required?

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.

How accurate is the disease detection?

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.

What crops are supported?

Disease detection covers 14 crop species (38 conditions). Crop recommendation supports 22 types including rice, wheat, cotton, apple, mango, banana, coffee, and various legumes.

Can it work without internet?

Disease detection runs locally (model loaded in browser/device). Soil analysis uses stored thresholds. Firebase synchronization occurs when connectivity is available.

Is farm data private?

Disease detection runs entirely client-side — images never leave your device. Soil data in Firebase is account-associated and not shared with third parties.

How does crop recommendation work?

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.

Research / Technical Audience

What CNN architecture is used and why?

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.

Why XGBoost over Random Forest?

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.

How was class imbalance addressed?

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.

What is the feature correlation structure?

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.

How does visualization integrate with inference?

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.

What evaluation metrics were used?

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.

What augmentation strategies were applied?

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.

10. Challenges, Solutions, and Future Work

10.1 Challenges and Solutions

ChallengeSolution
AI outputs incomprehensible to farmersModule-specific visualization templates (overlays, color-coded bars) replacing raw scores
Real-time mobile data deliveryFirebase Realtime Database for low-latency synchronization
CNN generalization across lightingData augmentation (shear, zoom, shift) during training
Chart readability for low-literacy usersColor thresholds (green/orange/red) eliminating numeric interpretation
Potential class imbalanceVerified balanced distribution (100 records/class) pre-training

10.2 Future Work

Planned
IoT Sensor Integration
Real-time soil streams via Firebase, eliminating manual entry.
Planned
Drone-Based Monitoring
Field-level disease assessment using aerial imagery and heatmaps.
Planned
Interactive Dashboards
Drill-down filtering for historical trends and seasonal comparison.
Planned
Voice Interface
Spoken query navigation for low-literacy farmers.
Planned
Multi-language Localization
Tamil, Hindi, Telugu, and Kannada interface translation.
Planned
Expanded CNN Coverage
Retraining on larger pathology datasets beyond 14 species.