Skip to content

Repository files navigation

🩺 Kidney Disease Classification using Deep Learning

Python TensorFlow DVC Flask

A production-ready End-to-End Machine Learning project to classify kidney diseases from CT scan images using Deep Learning. The project implements a robust MLOps pipeline, utilizing DVC for pipeline tracking, and serves the model via a Flask web application.

Python Version TensorFlow DVC Flask License: MIT

A production-ready pipeline for classifying kidney diseases from CT scan images, built with robust Data Version Control, Transfer Learning, and served via a Flask web application.


📑 Table of Contents

🚀 About the Project

Medical image classification requires rigorous tracking of data, hyperparameters, and models. This project demonstrates a complete End-to-End MLOps Lifecycle to detect kidney diseases (like tumors, cysts, or stones) from CT scan images.

Instead of a scattered Jupyter Notebook approach, this project is modular, scalable, and version-controlled using DVC (Data Version Control), making it highly reproducible for teams and ready for production deployment.

✨ Key Features

  • Transfer Learning: Utilizes pre-trained ImageNet models (VGG16/ResNet) tailored for binary/multiclass classification.
  • Reproducible Pipelines: Every step from data ingestion to model evaluation is tracked via DVC.
  • Dynamic Configuration: Easy experimentation by simply tweaking params.yaml and config.yaml.
  • Interactive UI: A built-in Flask web application allowing users to upload CT scans and get real-time predictions.
  • Cross-Origin Ready: Flask-Cors enabled, making it easy to attach a React/Vue frontend in the future.

🚀 Tech Stack

Domain Tools & Frameworks
Deep Learning TensorFlow, Keras
Data Processing NumPy, Pandas, OpenCV
MLOps & Tracking DVC, MLflow
Backend & Serving Flask, Flask-CORS
Visualization Matplotlib, Seaborn

🏗️ Architecture & MLOps Pipeline

The workflow is managed entirely by DVC (dvc.yaml), ensuring that changes in data or code only trigger the necessary stages.

graph TD;
    A[Stage 1: Data Ingestion] --> B[Stage 2: Prepare Base Model];
    B --> C[Stage 3: Model Training];
    A --> C;
    C --> D[Stage 4: Model Evaluation];
Loading
  1. data_ingestion: Fetches the dataset from a remote source, unzips, and prepares it in the artifacts/ directory.
  2. prepare_base_model: Downloads the VGG16/ResNet base architecture, freezes layers, and attaches custom classification heads.
  3. training: Applies data augmentation, batches data, and trains the model utilizing parameters defined in params.yaml.
  4. evaluation: Tests the trained model against a validation set and generates scores.json.

🏁 Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

  • Python 3.8 or higher
  • Git

Installation

  1. Clone the repo

    git clone https://github.com/Rudraksh225/kidney-classification.git
    cd kidney-classification
  2. Create and activate a virtual environment

    # Windows
    python -m venv venv
    .\venv\Scripts\activate
    
    # Linux/macOS
    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt

🎮 Usage

You can interact with this project in two ways: as a researcher running the pipeline, or as a user running the web interface.

1. Run the DVC Pipeline

If you want to train the model from scratch, alter hyperparameters, or update the dataset:

# Execute the entire MLOps pipeline
dvc repro

DVC will intelligently recognize which stages need to be run based on caching.

2. Start the Web App

To serve the pre-trained model and use the UI:

python app.py

Open your browser and navigate to http://localhost:8080.

  • Home (/): Upload an image for prediction.
  • Train (/train): Remotely trigger pipeline training.

⚙️ Configuration

Experiment tracking is incredibly simple. You do not need to dive into the python code to change model parameters.

Update params.yaml:

IMAGE_SIZE: [224, 224, 3]
BATCH_SIZE: 16
EPOCHS: 10
LEARNING_RATE: 0.01

Run dvc repro after changing params, and DVC will automatically detect the changes and retrain the model!


🤝 Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📜 License

Distributed under the MIT License. See LICENSE for more information.

Made with ❤️ for the Open Source Community

About

An end-to-end deep learning and MLOps pipeline to classify kidney diseases from CT scan images. Built with TensorFlow and transfer learning (VGG16), featuring reproducible data versioning via DVC, experiment tracking, and an interactive Flask web application.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages