Skip to content

PlantPedia leverages Vision Transformers (ViTs) and transfer learning to automate plant species identification from leaf images, reducing manual effort and supporting ecological research. It also integrates an AI chatbot using Google Generative AI (Gemini Pro) for interactive plant information retrieval.

License

Notifications You must be signed in to change notification settings

manish92596/PlantPedia

Repository files navigation

Screenshot (5412)


Screenshot (5413)


Screenshot (5414)

🌿 PlantPedia: Plant Leaf Classification and Information Retrieval

📑 Table of Contents

🌟 Introduction

PlantPedia is an AI-powered system designed for classifying plant species using Vision Transformers (ViTs) combined with transfer learning. The project aims to automate plant species identification by analyzing leaf images, significantly reducing manual efforts, and enhancing ecological and agricultural research. The system includes an AI chatbot powered by Google Generative AI (Gemini Pro) for interactive information retrieval on identified plants.

🚀 Features

  • Automated Plant Leaf Classification using Vision Transformers
  • Real-time chatbot for detailed plant information powered by Google Gen-AI
  • Interactive GUI developed using Streamlit
  • High accuracy of 95.97% with precision, recall, and F1-score each at 0.96

🌿 Dataset

  • Swedish Leaf Dataset: 1,125 images of 15 plant species
  • Extended Dataset: Added 10 additional plant species, bringing the total to 1,875 images across 25 classes

🔧 Methodology

  1. Image Preprocessing:

    • Resizing to 224x224 pixels
    • Normalization using ImageNet statistics
    • Data augmentation (rotations, flips, shifts) for better generalization
  2. Feature Extraction:

    • Leveraged pre-trained Vision Transformers to extract high-level features
    • Added a custom classifier: Linear layer (512 units) → ReLU → Dropout (0.5) → Output layer
  3. Transfer Learning & Fine-Tuning:

    • Freezed initial ViT layers and fine-tuned the final layers
    • Used an Adam optimizer with learning rate scheduling and early stopping
  4. Model Testing:

    • Evaluated on the test dataset using metrics like accuracy, precision, recall, F1-score, and a confusion matrix

🛠️ Installation

  1. Clone the Repository:
git clone https://github.com/manish92596/PlantPedia.git
cd PlantPedia
  1. Set Up a Virtual Environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install Dependencies:
pip install -r requirements.txt

🖥️ Usage

  1. Run the Streamlit Application:
streamlit run app.py
  1. Upload a Plant Leaf Image:
    • Get species classification and interact with the chatbot for more information

📊 Results

  • Model Accuracy: 95.97%
  • Precision: 0.96
  • Recall: 0.96
  • F1 Score: 0.96
  • Confusion Matrix: Visualizes model performance across all 25 classes

🔮 Future Work

  • Multilingual Support: Extend the chatbot's capabilities to support multiple languages
  • Disease Detection: Add functionality to detect plant diseases from leaf images
  • Scalability: Expand the dataset to include more plant species for broader classification

💻 Technologies Used

  • Framework: PyTorch with Hugging Face Transformers
  • Python Version: 3.11.5
  • Libraries:
    • torch
    • torchvision
    • transformers
    • scikit-learn
    • matplotlib
    • seaborn
  • Generative AI:
    • langchain-google-genai
    • langchain[openai,all]
    • langchain-community
    • sentence-transformers
  • GUI: Streamlit
  • Hardware: NVIDIA A100 GPUs with CUDA support

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a new branch: git checkout -b feature-branch
  3. Commit your changes: git commit -m 'Add feature'
  4. Push to the branch: git push origin feature-branch
  5. Open a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📬 Contact

Feel free to reach out for collaboration or queries:


Enjoy using PlantPedia! 🌱🌿🌳

About

PlantPedia leverages Vision Transformers (ViTs) and transfer learning to automate plant species identification from leaf images, reducing manual effort and supporting ecological research. It also integrates an AI chatbot using Google Generative AI (Gemini Pro) for interactive plant information retrieval.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published