This project is a simple web application made with Django // React // Tensorflow.
It provides an interface for users to upload images of plants and receive classification results using a pre-trained Convolutional Neural Network.
Screen.Recording.2024-02-29.at.12.04.06.mp4
- Upload Image: Users can upload an image of a plant using the drag-and-drop dropzone interface.
- Image Processing: The uploaded image is sent to the Django backend, where it is processed by a pre-trained TensorFlow model, which is a fine-tuned MobileNetV2 trained on a custom dataset of plant images.
- Classification: The model classifies the image into one of the 129 plant species with associated certainty percentages and presents the top prediction to the user.
The MobileNetV2 model used in the project has been trained by applying transfer learning on the last few layers and adding a fully connected dense classification layer. I used and modified a dataset of plant images obtained from a public project: 'plantnet-300k'. This dataset is not ideal for my use-case because it was designed for research, and because of this has the following issues:
- Strong class imbalance, long tailed distribution.
- Many species are visually similar and 'difficult (to classify) even for the expert eye'
- Has low quality user uploaded images.
To face these issues, I only kept classes with over 400 images and trimmed classes with +1000 images. This approach improved validation accuracy by a wide margin. For 129 classes of plants the model achieves about 59% test accuracy, which is far from ideal but sufficient for my MVP. Further improvements include expanding the dataset with more images, cleaning and filtering the current images, and training larger model architectures like ResNet.
To run the Plant App locally:
- Clone the repository.
- Navigate to the backend directory and install the required dependencies using
pip install -r requirements.txt
. - Run the Django backend server using
python manage.py runserver
. - Navigate to the frontend directory and install the required dependencies using
npm install
. - Start the React frontend server using
npm start
. - Access the Plant App in your web browser at
http://localhost:3000
.
This project is licensed under the MIT License. Feel free to use and modify it according to your needs.