PERNOSPHERE is a project made for the course AI-lab Computer Vision and NLP 2024/25. In this project, I implemented a basic Convolutional Neural Network (CNN) to categorize the most common diseases in vinegrape plants.
Carlo Da Roma
- Basic PyTorch CNN
- Training with early stopping and methods to avoid overfitting
- Simple web Gradio interface
- Details and explanations about the diseases
- High accuracy test (0.95%+)
- The dataset contains images of vinegrape leaves, either diseased or healthy.
- Author: Rajarshi Mandal
- License: CC0 1.0 Universal
-
Install Gradio, OpenCV (
cv2), PyTorch, Matplotlib, and Pandas -
Download the dataset from the link below: [https://www.kaggle.com/datasets/rm1000/grape-disease-dataset-original]
-
MOVE ALL THE SUB-DIRECTORIES (test,train) OF THE DOWNLOADED ZIP INTO
Archive/trainTest/leaf! -
Create a usable dataset (CSV, images) by launching
support_function_test.pyandsupport_function_train.py
Run the training script:
python train_test.pyIt will automatically stop.
Launch the Gradio GUI to use the app:
python app.py-
In the directory
Codethere are:model.py– CNN definitiondataloader.py– Custom dataloadertrain_test.py– Training and testing looppredict.py– Predictor functionGUI.py– Gradio web app
-
In the directory
Archivethere are the images of the dataset -
In the directory
Modelthere is the saved binary model -
In the directory
Datasetthere are the.csvfiles and a support function to create a usable dataset
- The model input images are resized to 128x128. The original size of the images is 512x512
- Early stopping patience is set to 3 epochs by default
- Typically, training for 9 to 10 epochs is enough to reach a test accuracy of at least 95%
- To achieve the best results, take the photo of the leaf on a sheet of paper.
last update 06/06/2025