Users can take or upload any image of a flower and the type of flower is recognised and returned
- YouTube Video
- Presentation Slides
- Application Demonstration - Selecting a Photo of a Calendula Flower from Gallery
- Application Demonstration - Selecting a Photo of a Carnation Flower from Gallery
- Application Demonstration - Taking a Photo of a Sunflower Flower using Device Camera
- Application Demonstration - Taking a Photo of a Daisy Flower using Device Camera
Dataset
- flowersDataset obtained from the following dataset found on Kaggle: Flower Dataset
Google Teachable Machine
-
The dataset contains the following 16 categories of flowers:
- Astilbe (737 Images)
- Bellflower (873 Images)
- Black Eyed Susan (1000 Images)
- Calendula (978 Images)
- California Poppy (1022 Images)
- Carnation (923 Images)
- Coreopsis (1047 Images)
- Daffodil (970 Images)
- Daisy (980 Images)
- Dandelion (1052 Images)
- Iris (1054 Images)
- Magnolia (1048 Images)
- Rose (999 Images)
- Sunflower (1027 Images)
- Tulip (1048 Images)
- Water Lily (982 Images)
-
Total Batch Size (Total number of images in the dataset): 15,740
-
Training Dataset - 85% (Used to train the models to correctly classify the image samples into the pre-existing classes): 13,379
-
Test Dataset - 15% (Not used to train the model; assess how well the model is performing on new, un-seen data): 2,361
-
Epoch (The number of times the training dataset has been fed through the model): 60
-
Batch Size (batch = set of samples used in one iteration of training): 16 --> Number of Batches = 13,379/16 = 837
-
Learning Rate (A tuning parameter in an optimization algorithm that determines the step size at each iteration while moving toward a minimum of a loss function): 0.001
Testing of the Image Classification Model
- Test images used to test accuracy of the image classification model: testImages
Classification Results
- Accuracy Per Class:
- Accuracy Per Epoch:
- Confusion Matrix:
- 3 Classes Most Easiest to Identify Based on the Confusion Matrix:
- Dandelion - 154
- Tulip - 154
- Sunflower - 150
- 3 Classes Most Difficult to Identify Based on the Confusion Matrix:
- Astilbe - 105
- Bellflower - 109
- Carnation - 118
- 3 Classes Most Easiest to Identify Based on the Confusion Matrix:
- Loss Per Epoch:
- Install Android Studio Flamingo
- Download folder IoTAndroidApplication
- Open folder in Android Studio
- Change IP Address to your own in NetworkClient.java
- Run on either Emulated Device or Physical Device
Steps to Start & Run Flask Server
- Download folder FlaskServer and open in any IDE
- Ensure Python Version > 3.8 using the following command: python3 --version
- Ensure Pip Version > 20.3: pip3 --version
- Install Miniconda using the following command: curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o Miniconda3-latest-MacOSX-x86_64.shbash Miniconda3-latest-MacOSX-x86_64.sh (specifically for MacOS; Choose according to your OS)
- Create a Conda Environment using the following command: conda create --name tf python=3.9
- Activate Conda Evironment using the following command: conda activate tf
- Upgrade Pip using the following command: pip install --upgrade pip
- Install TenserFlow using the following command: conda install -c conda-forge tensorflow
- Install all necessary packages: pillow, flask, etc
- Change IP Address to your own in test.py:
- Change to an available port number to utilise in model.py:
- Change directories to the FlaskServer folder using the following commad: cd FlaskServer
- Run python file, using the following command: python model.py
- To deativate the Conda Environment, run the following command: conda deactivate
test.py
- Add any flower image that you wish to test to the following folder: testImages
- Change the following file path in test.py: resp = requests.post("http://192.168.10.141:8000", files={'file': open('/Users/nikitabachhas/IoTCourseProject/IoTCourseProject/TestImages/water_lily.jpg', 'rb')})
- Execute the model.py in the FlaskServer folder
- Execute test.py file
test.py results
- The following imges shows the results obtained when the test image of a water lily is used to test the integration of the flask server with the model and the accuracy of the model:
Steps to Create a VM Instance
- Click on Compute Engine
- Click on VM Instances
- Ensure that Region = asia-southeast1(Singapore)
- Click Create
Steps to Start & Run Flask Server on VM
- Use the command pwd to identify the directory that you are in and the command ls to get a list of all the files downloaded or uploaded into the virtual machine
- Install wget onto your virtual machine using the following command: sudo apt-get install wget
- Download Miniconda onto your virtual machine using the following command: wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh (specifically for those using a Debian/Linux VM)
- Execute the downloaded Miniconda file in your virtual machine by using the following command: bash Miniconda3-latest-Linux-x86_64.sh
- Restart your virtual machine
- Ensure python is installed by using the following command: python
- Exit from the python environment using the following command: exit()
- Upload these three files into the vritual machine: keras_model.h5, labels.txt and model.py
- Create a Conda Environment using the following command: conda create --name tf python=3.9
- Activate Conda Evironment using the following command: conda activate tf
- Upgrade Pip using the following command: pip install --upgrade pip
- Install TenserFlow using the following command: conda install -c conda-forge tensorflow
- Install all necessary packages: pillow, flask, etc
- Run python file, using the following command: python model.py
- To deativate the Conda Environment, run the following command: conda deactivate