Skip to content

vanshoberoi-dev/Jute-Pest-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› Jute Pest Classification System

Streamlit App

An intelligent web application for identifying and classifying 17 different types of jute pests using an optimized TensorFlow Lite deep learning model. This system provides farmers and agricultural experts with an easy-to-use tool for rapid pest identification.

A basic jute pest type classifier based on pest image

🌐 Live Demo

Try it now jute-pest-classifier.streamlit.app

✨ Features

  • 🎯 High Accuracy 95.5% test accuracy with optimized TFLite model
  • ⚑ Real-time Classification Instant pest identification from uploaded images
  • πŸ“Š Confidence Scoring Detailed probability scores for all predictions
  • πŸ† Top-3 Predictions Alternative possibilities with confidence levels
  • πŸ“± User-friendly Interface Clean, intuitive web interface
  • πŸš€ Cloud Deployment Deployed on Streamlit Community Cloud
  • πŸ“ˆ Detailed Analytics Complete probability breakdown for all 17 pest classes

πŸš€ Quick Start

Prerequisites

  • Python 3.8 or higher
  • 4GB+ RAM (for model loading)
  • Modern web browser

Installation

  1. Clone the repository
git clone repository-url
cd Jute-Pest-Classification
  1. Install dependencies
pip install -r requirements.txt
  1. Run the application
streamlit run app.py
  1. Access the app

πŸ“ Project Structure

Jute-Pest-Classification
β”œβ”€β”€ πŸ“„ app.py                     # Main Streamlit application
β”œβ”€β”€ πŸ““ JP.ipynb                   # Jupyter notebook for model training
β”œβ”€β”€ πŸ“‹ requirements.txt           # Python dependencies
β”œβ”€β”€ πŸ€– jute_pest_model.tflite     # Optimized TFLite model (~42MB)
β”œβ”€β”€ πŸ“– README.md                  # This documentation
└── πŸ“– LICENSE                  # LICENSE

πŸ› Supported Pest Classifications

The system can accurately identify and classify 17 different jute pest species

Pest List

# Pest Name Category Damage Type
1 Beet Armyworm Lepidoptera Leaf feeder
2 Black Hairy Caterpillar Caterpillar Defoliator
3 Cutworm Lepidoptera Rootstem cutter
4 Field Cricket Orthoptera Omnivorous
5 Jute Aphid Hemiptera Sap sucker
6 Jute Hairy Caterpillar Caterpillar Leaf feeder
7 Jute Red Mite Acari Sap sucker
8 Jute Semilooper Lepidoptera Defoliator
9 Jute Stem Girdler Coleoptera Stem borer
10 Jute Stem Weevil Coleoptera Stem borer
11 Leaf Beetle Coleoptera Leaf feeder
12 Mealybug Hemiptera Sap sucker
13 Pod Borer Lepidoptera Podseed feeder
14 Scopula Emissaria Lepidoptera Defoliator
15 Termite Isoptera Woodcellulose feeder
16 Termite odontotermes (Rambur) Isoptera Soilroot feeder
17 Yellow Mite Acari Sap sucker

πŸ“Š Model Performance & Specifications

Performance Metrics

  • 🎯 Test Accuracy 95.5%
  • ⚑ Inference Time 1-3 seconds per image
  • 🧠 Model Architecture TensorFlow Lite (Optimized)
  • πŸ“ Input Resolution 480Γ—480 pixels
  • πŸ’Ύ Model Size ~42MB
  • πŸ”„ Loading Time Instant loading

Technical Details

  • Framework TensorFlow Lite
  • Pre-training ImageNet-21k (original BiT model)
  • Fine-tuning Custom jute pest dataset
  • Optimization TFLite conversion with quantization
  • Deployment Streamlit Community Cloud

🎯 How to Use

Step-by-Step Guide

  1. πŸš€ Launch the Application

    streamlit run app.py
  2. ⚑ Instant Loading

    • Model loads instantly from optimized TFLite format
    • No waiting time required
  3. πŸ“€ Upload an Image

    • Click Browse files or drag & drop
    • Supported formats JPG, JPEG, PNG, BMP
    • Recommended Clear, well-lit images
  4. πŸ” View Results

    • Primary Prediction Most likely pest type
    • Confidence Score Model certainty (0-100%)
    • Top 3 Predictions Alternative possibilities
    • Full Analysis Complete probability breakdown

πŸ“Έ Image Guidelines

βœ… Good Images ❌ Avoid
Clear, focused pest Blurry or out-of-focus
Good lighting Too dark / too bright
Pest fills frame Pest too small
Single pest visible Multiple pests
Natural colors Heavy filters

⚑ Performance Optimization

Model Size Optimization

For faster loading times, you can create optimized model versions

  1. TensorFlow Lite Conversion (Recommended)

    python convert_to_tflite.py
    • Reduces model size by 50-80%
    • Faster loading and inference
    • Maintains high accuracy
  2. Model Compression

    python optimize_model.py
    • Creates optimized SavedModel
    • Better memory efficiency

πŸ”§ Troubleshooting

Common Issues & Solutions

Issue Solution

Model loading fails Ensure my_saved_bit_model contains all files Slow first load Normal behavior - subsequent loads are cached Low accuracy Use clear, well-lit images with visible pests Memory errors Ensure 4GB+ RAM available Import errors Run pip install -r requirements.txt

Model File

The optimized model file

jute_pest_model.tflite    # 42MB TensorFlow Lite model

Model Conversion

The TFLite model was converted from the original BiT model for optimal deployment

  1. Original training See JP.ipynb notebook
  2. Model conversion Converted to TensorFlow Lite format
  3. Optimization Quantized for smaller size and faster inference

API Integration

The core prediction function can be used independently

from app import load_model, preprocess_image, predict_pest

# Load model once
model = load_model()

# Predict on new image
image_array = preprocess_image(your_image)
pred_idx, confidence, probabilities = predict_pest(model, image_array)

πŸ“Š Dataset Information

  • Total Images Varies by class
  • Image Resolution 512Γ—512 pixels
  • Format RGB color images
  • Split TrainValidationTest
  • Augmentation Rotation, flip, zoom, brightness

πŸ”¬ Research & Citations

This project was made using dataset provided by University of California, Irvine (UCI) Machine Learning Repository

@misc{jute_pest_920,
  author       = {Islam, Muhammad Tanvirul},
  title        = {{Jute Pest}},
  year         = {2024},
  howpublished = {UCI Machine Learning Repository},
  note         = {{DOI}: https://doi.org/10.24432/C5289P}
}

This project is based on the BiT (Big Transfer) model architecture, optimized for deployment

@article{kolesnikov2020big,
  title={Big Transfer (BiT) General Visual Representation Learning},
  author={Kolesnikov, Alexander and Beyer, Lucas and Zhai, Xiaohua and Puigcerver, Joan and Yung, Jessica and Gelly, Sylvain and Houlsby, Neil},
  journal={ECCV},
  year={2020}
}

🀝 Contributing

We welcome contributions! Here's how to get started

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch
    git checkout -b featureamazing-feature
  3. πŸ’» Make your changes
  4. βœ… Test thoroughly
  5. πŸ“ Commit your changes
    git commit -m Add amazing feature
  6. πŸš€ Push to the branch
    git push origin featureamazing-feature
  7. πŸ”„ Open a Pull Request

πŸ“„ License

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

πŸ™ Acknowledgments

  • TensorFlow Team for the excellent deep learning framework
  • Streamlit Team for the amazing web app framework
  • Google Research for the BiT model architecture
  • Agricultural Research Community for pest classification datasets

πŸ“ž Support & Contact


⭐ Star this repository if it helped you!
Made with ❀️ for the agricultural community

About

Fine-tuned ResNet101 to classify Jute Pest out of 17 classes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors