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
Try it now jute-pest-classifier.streamlit.app
- π― 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
- Python 3.8 or higher
- 4GB+ RAM (for model loading)
- Modern web browser
- Clone the repository
git clone repository-url
cd Jute-Pest-Classification- Install dependencies
pip install -r requirements.txt- Run the application
streamlit run app.py- Access the app
- Open your browser and navigate to
http://localhost:8501 - Or use the live demo https://jute-pest-classifier.streamlit.app/
- Open your browser and navigate to
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
The system can accurately identify and classify 17 different jute pest species
| # | 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 |
- π― 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
- 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
-
π Launch the Application
streamlit run app.py
-
β‘ Instant Loading
- Model loads instantly from optimized TFLite format
- No waiting time required
-
π€ Upload an Image
- Click Browse files or drag & drop
- Supported formats JPG, JPEG, PNG, BMP
- Recommended Clear, well-lit images
-
π View Results
- Primary Prediction Most likely pest type
- Confidence Score Model certainty (0-100%)
- Top 3 Predictions Alternative possibilities
- Full Analysis Complete probability breakdown
| β 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 |
For faster loading times, you can create optimized model versions
-
TensorFlow Lite Conversion (Recommended)
python convert_to_tflite.py
- Reduces model size by 50-80%
- Faster loading and inference
- Maintains high accuracy
-
Model Compression
python optimize_model.py
- Creates optimized SavedModel
- Better memory efficiency
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
The optimized model file
jute_pest_model.tflite # 42MB TensorFlow Lite model
The TFLite model was converted from the original BiT model for optimal deployment
- Original training See
JP.ipynbnotebook - Model conversion Converted to TensorFlow Lite format
- Optimization Quantized for smaller size and faster inference
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)- Total Images Varies by class
- Image Resolution 512Γ512 pixels
- Format RGB color images
- Split TrainValidationTest
- Augmentation Rotation, flip, zoom, brightness
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}
}We welcome contributions! Here's how to get started
- π΄ Fork the repository
- πΏ Create a feature branch
git checkout -b featureamazing-feature
- π» Make your changes
- β Test thoroughly
- π Commit your changes
git commit -m Add amazing feature
- π Push to the branch
git push origin featureamazing-feature
- π Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- 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
- π§ Email vanshoberoi462@gmail.com
β Star this repository if it helped you!
Made with β€οΈ for the agricultural community