An AI-powered irrigation scheduling system designed to optimize water usage in agriculture by leveraging machine learning, data analytics, and cross-language support including R and PySpark.
This project aims to enhance agricultural productivity by providing intelligent irrigation recommendations.
By analyzing environmental and crop data, the system determines optimal watering schedules, ensuring efficient water utilization and promoting sustainable farming practices.
- Machine Learning Models: Implements both teacher and student models using PyTorch and ONNX for efficient inference.
- Data Analysis: Utilizes Jupyter notebooks and R scripts for exploratory data analysis to understand and preprocess the dataset.
- Big Data Processing: Employs PySpark for training large-scale teacher models.
- API Service: Provides a FastAPI-based backend to serve model predictions.
- Docker Integration: Includes Docker support for containerized deployment.
- Streamlit GUI: Offers a GUI for user to specify sensor readings and recieve prediction.
- Power BI Dashboard: Offers a Power BI report for visualizing irrigation schedules and model insights.
├── app.py # FastAPI application
├── Dockerfile # Docker configuration
├── eda-aihtproject.ipynb # Exploratory Data Analysis notebook (Python)
├── analysis_r_code.R # Exploratory Data Analysis in R
├── frontend.py # Frontend interface (Streamlit)
├── irrigation_aiht_powerbi.pbix # Power BI dashboard file
├── Irrigation Scheduling.csv # Dataset for training and analysis
├── model_train_and_export.py # Script to train and export models
├── pyspark_teacher.py # PySpark implementation for teacher model
├── requirements.txt # Python dependencies
├── student_model.onnx # Exported student model in ONNX format
├── student_model.pt # Trained student model in PyTorch format
├── teacher.py # Teacher model training script
├── teacher_model.pt # Trained teacher model in PyTorch format
├── test_input.txt # Sample input for testing
└── README.md # Project documentation
- Python 3.8 or higher
- Docker (for containerized deployment)
- R (for R-based data analysis)
- Apache Spark (for running PySpark)
- Streamlit (for running GUI)
-
Clone the repository
git clone https://github.com/OnePunchMonk/AIHT-Project.git cd AIHT-Project
-
Create and activate a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Python dependencies
pip install -r requirements.txt
-
Install R packages (for R analysis)
install.packages("tidyverse") install.packages("data.table")
-
Train and export to ONNX
python model_train_and_export.py
-
Run the teacher model using PySpark
spark-submit pyspark_teacher.py
-
Build the Docker image
docker build -t irrigation-model .
-
Run the Docker container
docker run -p 8000:8000 irrigation-model
You can test the prediction endpoint using curl
or any API testing client:
curl -X POST http://localhost:8000/predict -H "Content-Type: multipart/form-data" -F "file=@test_input.txt"
eda-aihtproject.ipynb
: R script for additional statistical analysis and visualizations. (Run on Kaggle env)
irrigation_aiht_powerbi.pbix
: Power BI dashboard for irrigation schedules and model insights.frontend.py
: GUI for non-technical users.
For a hardware simulation of the irrigation system, refer to the AIHT Wokwi Simulation Repository.
https://wokwi.com/projects/428958546126055425
Note: Ensure all environment variables and configurations are set appropriately before deploying the application.