Skip to content

๐Ÿ–ผ๏ธ End-to-end image classification - ๐Ÿงฑ custom CNN, ๐Ÿ” transfer learning, ๐Ÿ”ญ Vision Transformer, and ๐Ÿงฉ XAI visualizations in a ๐ŸŒ Streamlit app.

License

Notifications You must be signed in to change notification settings

Shourav-Deb/Citrus-Net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

37 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŠ Introducing Citrus-Net

An end-to-end image classification pipeline that combines ๐Ÿงฑ Custom CNN, ๐Ÿ” Transfer Learning, and ๐Ÿ”ญ Vision Transformer models - enhanced with ๐Ÿงฉ Explainable AI (XAI) visualizations and deployed in a Streamlit app.


Project Banner


๐Ÿ“Œ Repository Description

This repository contains the complete project for building and explaining a full image classification pipeline. The pipeline moves from a hand-crafted CNN baseline to state-of-the-art deep learning models, enriched with Explainable AI (XAI) methods, and deployed as an interactive Streamlit web app.

๐Ÿš€ Project Stages

  • ๐Ÿ”Ž Data Preparation โ€“ Exploratory analysis, class balance checks, preprocessing, and augmentations.
  • ๐Ÿงฑ Custom CNN (CitrusNet) โ€“ Novel convolutional network designed and trained from scratch.
  • ๐Ÿ” Transfer Learning โ€“ Fine-tuning four pretrained CNN backbones (ImageNet weights).
  • ๐Ÿ”ญ Vision Transformer (ViT) โ€“ Transformer-based classifier for advanced performance.
  • ๐Ÿงฉ XAI (Explainability) โ€“ Applying Grad-CAM, Score-CAM, LIME, and SHAP to interpret predictions.
  • ๐ŸŒ Streamlit App โ€“ User-friendly interface for image upload, prediction, and interactive XAI visualizations.

โœ… Key Features

  • ๐Ÿงฑ Custom Made CNN [CitrusNet] with โ‰ฅ65% accuracy (baseline target).
  • ๐Ÿ” Transfer learning with four unique CNN architectures.
  • ๐Ÿ”ญ Vision Transformer experiment.
  • ๐Ÿ“Š Comparative evaluation (accuracy, precision, recall, F1, confusion matrices).
  • ๐Ÿงฉ XAI overlays on โ‰ฅ10 test images with detailed interpretation.
  • ๐ŸŒ Streamlit app for model selection, predictions, and side-by-side explanations.
Model Training Type Test Accuracy Macro F1 Notes
EfficientNet-B0 Transfer Learning Highest (reported best) Highest Selected for XAI & deployment
ResNet34 Transfer Learning Slightly lower than EfficientNet High Very stable baseline
ConvNeXt-Tiny Transfer Learning Comparable to ResNet High Heavier, no clear gain
CitrusNet (Proposed) From Scratch ~97% ~0.97 Excellent for custom CNN
DenseNet121 Transfer Learning Lower than ResNet Moderate Less stable
ViT-B/16 Transformer Lowest Lowest Data-limited underperformance

๐Ÿ› ๏ธ Tech Stack

  • Python (PyTorch, torchvision, scikit-learn, Captum, pytorch-grad-cam, LIME)
  • Streamlit for deployment
  • Matplotlib / Seaborn for plots
  • Google Colab / Kaggle GPU for training

๐Ÿ“‚ Dataset

  • I used the Citrus Fruit Dataset containing high-quality images of citrus fruits for training, validation, and testing.

๐Ÿ“‘ Deliverables (After Contact)

  • ๐Ÿ“„ Scientific Project Report (IEEE/ACM style).

  • ๐Ÿ“ฆ 6 Runnable Jupiter Notebook Code.

  • ๐Ÿ’พ 6 Trained Model Weights.

    • CitrusNet_[custom_cnn].pt
    • Efficientnet_B0.pt
    • Resnet34.pt
    • Densenet121.pt
    • Convnext_Tiny.pt
    • VIT_Best.pt

๐Ÿš€ Quick Start

๐ŸŒ Use the Web App

  1. Open the live application [No installation required]
    ๐Ÿ‘‰ Citrus Fruit Classification

  2. From the left sidebar:

    • Select a model: (Best Model Used)
      • CitrusNet [Custom]
      • EfficientNet-B0 [Best]
      • ResNet34
      • or Upload your own .pt model
    • Upload one or more citrus fruit images (.jpg, .png)
  3. View the results:

    • Predicted fruit class
    • Confidence score
    • Grad-CAM visual explanations
    • Optional LIME explanations

โš ๏ธ Important Display Notice

  • This app is styled for Dark mode. Light theme may hide some UI elements.
  • Change via [Right Side โ‹ฎ โ†’ Settings โ†’ App Theme โ†’ Dark].

๐Ÿ’ป Run Locally (Optional)

git clone https://github.com/Shourav-Deb/Citrus-Net.git
cd Citrus-Net
pip install -r requirements.txt
streamlit run app.py

๐Ÿ“ง Contact

If you need the trained notebook, models or report file for academic purposes, feel free to Contact Anytime.

โญ Acknowledgements

  • Built with PyTorch, torchvision, scikit-learn, pytorch-grad-cam, LIME, and Streamlit.
  • Inspired by cutting-edge research in Computer Vision & Explainable AI (XAI).

About

๐Ÿ–ผ๏ธ End-to-end image classification - ๐Ÿงฑ custom CNN, ๐Ÿ” transfer learning, ๐Ÿ”ญ Vision Transformer, and ๐Ÿงฉ XAI visualizations in a ๐ŸŒ Streamlit app.

Topics

Resources

License

Stars

Watchers

Forks