These instructions will make for the successful deployment of the system implementation on a Ubuntu 16.04 OS.
Software Prerequisites
The following softwares are required in order to deploy the system:
- OpenCV3
- TensorFlow
- Keras
- Flask
To install the above software follow the respective installation instructions detailed below.
OpenCV
OpenCV is an open source library aimed at real-time computer vision. OpenCV3 can be installed on a Linux OS by following the steps in the tutorial link:
https://www.learnopencv.com/install-opencv3-on-ubuntu/
TensorFlow
TensorFlow is an open source library used for machine learning applications. TensorFlow can be installed on a Linux OS using the following commands:
First, try installing TensorFlow directly using pip
$ sudo pip install tensorflow==1.12.0
If that installation is unsuccessful, try upgrading python versions by following this tutorial link:
https://www.tensorflow.org/install/pip
Keras
Keras is an open-source neural-network library written in Python. It is capable of running on top of TensorFlow. Keras can be installed on a Linux OS using the following command:
$ sudo pip install keras==2.1.4
Flask
Flask is a micro web framework written in python. Flask can be installed on a Linux OS using the following command:
$ sudo pip install flask
The following descibes the different software development components all found in the /FYP/src/main directory.
image_processing
This directory contains all the image processing scripts used to prepare the raw dataset for training.
- remove_background.py
- resize_images.py
Within the /tools directory, there is also:
- balance_data.sh
- rename_files.sh
Within the /samples directory, there is also:
- create_samples.sh
train_model
This directory contains the script for training the Keras CNN model.
- train_keras.py
tests
This directory contains the test_images, test_models and test_training sub-directories. In the /test_model directory, the CNN training models for various numbers of classes can be found.
The most relevant model is our most accurate, and can be found in /trained_model_31_classes:
- model.h5
web_app
This directory contains all the code to run our web app online plant classification system.
- app.py
In order to deploy the online plant classifier system follow the steps below:
Firstly navigate into the /web_app directory:
$ cd /FYP/src/main/web_app
Next run the app.py script
$ python app.py
This will launch the app, and display a link to an ip address. Click to open the link, and it will open the browser and display the app web page.
To use the Plant Classification app:
- Select the 'Browse...' button in the centre of the interface to open your file system.
- Choose a plant image to classify, before selecting it for upload.
- Once it has been uploaded, click the 'Submit' button
- An instant classification prediction for your image will be displayed on the screen.
- Repeat the steps above for each new image you wish to classify.
To test the classifier app, a folder of unseen flower images has been included.
These images can be found in the directory /tests/test_images
To test the app, follow the steps outlined above, and simply choose one of the test images from this folder to be uploaded. Then simply press Submit on the app screen and a prediction result will be returned.