AgroExpert is a project designed to help farmers identify plant diseases through leaf images and receive expert guidance on agricultural concerns.
- Dataset To train the model, download the dataset from Kaggle: Dataset Link: Plant Village Dataset on Kaggle This dataset includes:
- 54,305 images of diseased and healthy plant leaves across 14 crop species.
- Coverage of 17 basic diseases, including bacterial, viral, and mold-based diseases.
(Note : Check folder models where you can see already trained models. System is initialised with models-->model_version1.h5 , trained using 35 classes from the plant village dataset. models-->model_final.h5 is trained using whole dataset)
This project requires the following libraries:
- sqlite3: For database management to store user and model data.
- hashlib: For hashing passwords securely.
- getpass: To hide password input.
- os: For file and path management.
- datetime: To work with date and time functionalities.
-
TensorFlow and Keras:
-
Used to manage machine learning models.
-
Installation:
pip install tensorflow
-
-
NumPy:
-
Required for numerical operations, especially with TensorFlow and Keras models.
-
Installation:
pip install numpy
-
-
Matplotlib and Pillow (PIL):
-
matplotlib: For plotting and visualizing data. -
Pillow (PIL): For image processing. -
Installation:
pip install matplotlib pillow
-
-
Pytest
- For running test cases automatically, install pytest
pip install pytest
- For running test cases automatically, install pytest
- config.py: Contains configurations for database paths, model paths, and other constants.
- main.py: The primary file for managing Farmer and Expert access and functionality. Handles role-based menus and user authentication.
- admin_functions.py: Manages administrative tasks, such as: User management, Model activation and training, Viewing system statistics.
- auth.py:Handles user authentication, login, and registration with hashed passwords.
- db.py: Sets up database connections and includes functions for initializing models and user data.
The AgroExpert system includes an initialization process to set up required database structures and model information. The setup process is handled by initialize_system().
Prerequite: clone the repository using the following command.
git clone https://github.com/Beena-Kurian/AgroExpert.git
cd AgroExpert
Navigate to the AgroExpert Folder, then run
python config.py
The config.py file will initialise DB, model classes,model version, and it will verify the database by importing functions from db.py from db import init_database, init_model_classes, init_first_model, verify_database
python main.py
This includes farmer and expert registration and Logins.
- Login
- Register
- Exit
-
Once the user login as Farmer/Expert, the dashbboard for them can be accessed to do the intended operations.
-
Once farmer is registered, he can login to do different functionalities.
Farmer can perform operations like:
- Upload Image for Disease Identification
- Request Expert Consultation
- View My Consultations
- View Sample Requests
- View My Rewards
- View Points History
- Redeem Points
- Back to Main Menu
- View News
- Update Profile
- Update Email
- Update Phone Number
- Go Back
- Crop Management
- View My Alerts
- Logout
Note: Experts must be approved by an admin before accessing the system. Once Expert is registered, and approved, he can perform operations like:
- View Pending Consultations
- Provide diagnosis and treatment
- Request more images (Unknown Disease)
- View My Rewards
- View Points History
- Redeem Points
- Back to Main Menu
- View News
- Update Profile
- Update Email
- Update Phone Number
- Go Back
- Review Pending Sample Submissions
- Logout
python admin_functions.py
Admin dashboard can be viewed by running the above code.
Admin can perform operations like:
- User Management
- View All Users
- Approve/Reject Expert Registrations
- Back to Admin Menu
- Manage News
- Add News
- View All News
- Delete News
- Back
- View System Statistics
- Model Management
- Train New Model
- Train with existing classes
- Train with existing classes + new disease classes
- View Model Versions
- View Current Classes
- Activate Model
- View Latest Training Curves
- Back
- Train New Model
- Gift Card Management
- Add a Single Gift Card
- Add Multiple Gift Cards
- View All Gift Cards
- Deactivate a Gift Card
- Back to Admin Menu
- Manage Disease Outbreaks
- Create New Alert
- View Existing Alerts
- Back to Admin Menu
- Logout
Type the following command in the terminal/ command line,
pytest tests/ -v
- This will run the automatic test codes written inside the
testdirectory. - config and db test file is test_db.py