Skip to content

Latest commit

Β 

History

History
96 lines (66 loc) Β· 3 KB

File metadata and controls

96 lines (66 loc) Β· 3 KB

Project logo

Pandemic

Status


Recognize if a leave is healthy or not through a single picture

πŸ“ Table of Contents

🧐 About

Pandemic is a project that aims to indentify if a leave is healthy or not through a single picture of it. To do so, we're using convolutional neural networks and the dataset from PlantVillage.

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Make sure you have all of the Python dependencies already installed, including Jupyter and TensorFlow, along with the dataset from PlantVillage. You can either git clone it or use svn to download only the important folders since the repository is way too large, like so:

svn checkout https://github.com/spMohanty/PlantVillage-Dataset/trunk/raw/color/Grape___Esca_\(Black_Measles)

Installing

First of all, install all of the dependencies:

pip install -r requirements.txt

Then create a dataset folder containing two subfolders, those 2 will be the classes that you want to classify later one. In the end, you should have a folder structure like so:

src
β”œβ”€β”€ balance_data.py
β”œβ”€β”€ cnn.ipynb
β”œβ”€β”€ dataset
β”‚Β Β  β”œβ”€β”€ bad
β”‚Β Β  └── healthy
β”œβ”€β”€ load_dataset.py
β”œβ”€β”€ predict.py
β”œβ”€β”€ README.md
└── requirements.txt

In case your dataset is imbalanced (way more data from one class than the other), you can try to augment your data with the balance_data.py script. Change the folder that you want it to work on, then run:

python balance_data.py

Then you can start your Jupyter server with jupyter notebook inside our work folder, open the cnn.ipynb notebook and start to work on it.

🎈 Usage

If you want to try out a model generated by our previous notebook, you can do so by simply running the predict.py script with the appropriate h5 model. Be aware that the input image needs to be of size 256x256 pixels. A simple way to scale all images, which is commented inside predict.py is:

size = 256, 256

# change this to your actual path
path = "test"
num = 0

for item in os.listdir(path):
    file = os.path.join(path, item)
    im = Image.open(file)
    im = im.resize(size)
    im.save(os.path.join(path, (str(num) + ".jpg")))
    num += 1
    os.remove(file)

πŸš€ Deployment

TODO