Skip to content

cuulee/crop-disease-classification

 
 

Repository files navigation

Automated classification of tomato plant disease

Deep learning based automated tomato plant disease classification covering over 40 disease classes and 4 healthy classes.

Get Started

Instal python virtualenv

sudo apt install virtualenv virtualenv --system-site-packages -p python3 py35

Activate the python virtualenv (run from root)

source py35/bin/activate

Install dependencies

sh requirements.sh

Note:

  1. To setup nginx properly, follow the setup tutorial here: https://www.matthealy.com.au/blog/post/deploying-flask-to-amazon-web-services-ec2/

  2. Delete the default nginx page
    sudo rm /etc/nginx/sites-enabled/default

  3. Restart the nginx server
    sudo service nginx restart

Project tree

Training the image-classification model

Activate the python virtualenv (run from root)

source py35/bin/activate

Change the dir to crop_classifcation_updated

cd KisanLab_CPU

Train the inceptionV3 model (more accurate, larger size, slow to train)

sh train.sh

or

Train the mobilenet model (less accurate, smaller size, fast to train)

sh train_mobilenet.sh

API

Kisan_app folder contains all the files for the API.

How to run the API?

Start the server (run from root)

source py35/bin/activate

Change dir to server dir

cd crop_classification_updated/kisan_app

Start the server (logging occurs in nohup.out file)

nohup gunicorn app:app -b localhost:8000 &

Access API via curl cmd

curl -F file=@/path/to/your/image ${PUBLIC_IP_OF_EC2_INSTANCE}/api_call

Output (in json)

[ { "Prediction1": "tomato fruit borer", "Confidence1": "0.490311", "Confidence2": "0.258647", "Prediction2": "cutworm on tomato" } ]

or

Access the web-api via the public IP of the ec2 instance

Output

Alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.7%
  • Shell 8.9%
  • HTML 0.4%