Published February 4, 2026 | Version v1.0.0
Software Open

rezaul-h/CottonVerse: CottonVerse

Description

Version 1.0.0 โ€” Initial release

CottonVerse ๐ŸŒฟ

CottonVerse is a multi-model Flask-based web application for image classification tasks in the agricultural and textile domains. It enables interpretable prediction using Grad-CAM and supports four independent models:

  • ๐Ÿƒ Cotton Leaf Disease (CottonLeafNet)
  • ๐ŸŒฟ Cotton Leaf Disease (SAR-CLD-2024)
  • ๐Ÿงต Fabric Texture Percentage (CottonFabricImageBD)
  • ๐Ÿฉธ Fabric Stain Type (FabricSpotDefect)

๐Ÿš€ Features

  • ๐Ÿ“ Drag-and-drop file upload
  • โœ… Prediction probabilities with visual bar chart
  • ๐Ÿ”ฅ Grad-CAM visualization for interpretability
  • ๐Ÿ“ธ Upload preview and CAM download
  • ๐Ÿ–ผ๏ธ Multiple datasets and models supported
  • ๐Ÿง  Powered by LEViT model (via PyTorch + timm)
  • ๐ŸŽจ Responsive, modern, and interactive UI

๐Ÿ“‚ Project Structure

cottonverse/
โ”œโ”€โ”€ app.py                     # Flask app
โ”œโ”€โ”€ utils.py                   # Preprocessing & Grad-CAM logic
โ”œโ”€โ”€ models/                    # Trained .pth models
โ”œโ”€โ”€ static/
โ”‚   โ”œโ”€โ”€ uploads/               # Uploaded images
โ”‚   โ””โ”€โ”€ cams/                  # Grad-CAM outputs
โ”œโ”€โ”€ templates/                 # HTML templates
โ””โ”€โ”€ requirements.txt           # Dependencies
โ””โ”€โ”€ README.md

โš™๏ธ Installation

  1. Clone the repository:
git clone https://github.com/rezaul-h/CottonVerse.git
cd cottonverse
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # or venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
python app.py
  1. Open http://127.0.0.1:5000 in your browser ๐ŸŒ

๐Ÿ“Š Models & Datasets

| Model Name | Dataset | Classes | |------------|------------------------|---------| | LEViT | CottonLeafNet | 8 | | LEViT | SAR-CLD-2024 | 9 | | LEViT | CottonFabricImageB | 13 | | LEViT | FabricSpotDefect | 12 |

All models are trained using the LEViT architecture with PyTorch, saved in .pth format.

๐Ÿงช How to Use

  1. Click on a model on the landing page.
  2. Upload an image for classification.
  3. View prediction probabilities and Grad-CAM.
  4. Download the CAM if desired.

๐Ÿ“ฆ Dependencies

  • Flask
  • PyTorch
  • timm
  • torchvision
  • OpenCV
  • matplotlib
  • pytorch-grad-cam

๐Ÿ™ Acknowledgements

  • LEViT model: Facebook AI
  • GradCAM: Jacob Gildenblat (pytorch-grad-cam)

Files

rezaul-h/CottonVerse-v1.0.0.zip

Files (140.3 MB)

Name Size Download all
md5:c507a18c341381b35bdf78ceaf6d53cb
140.3 MB Preview Download

Additional details

Related works