Skip to content

A full-stack deep learning project that classifies chest X-ray images into various cancer categories using TensorFlow/Keras. It integrates data versioning (DVC), model tracking, Docker, and a Flask-based web interface, with CI/CD workflows through GitHub Actions and remote storage on DAGsHub.

License

Notifications You must be signed in to change notification settings

ArpitKadam/Chest-Cancer-Classification-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🫁 Chest Cancer Classification App

A full-stack deep learning project that classifies chest X-ray images into various cancer categories using TensorFlow/Keras. It integrates data versioning (DVC), model tracking, Docker, and a Flask-based web interface, with CI/CD workflows through GitHub Actions and remote storage on DAGsHub.


πŸ“Œ Features

  • 🧠 Deep Learning CNN model using transfer learning (EfficientNet)
  • πŸ“¦ Modular codebase with pipeline stages (data_ingestion, base_model, training, evaluation)
  • πŸš€ Real-time prediction web app using Flask
  • πŸ“ˆ Model evaluation and confidence scores
  • πŸ” Reproducible experiments with DVC
  • 🐳 Dockerized for seamless deployment
  • ☁️ Remote artifact storage using DAGsHub
  • βš™οΈ GitHub Actions for CI/CD automation

πŸ“ Project Structure

Click to expand/collapse
└── arpitkadam-chest-cancer-classification-app/
    β”œβ”€β”€ README.md
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ app.py
    β”œβ”€β”€ demo.py
    β”œβ”€β”€ Dockerfile
    β”œβ”€β”€ dvc.lock
    β”œβ”€β”€ dvc.yaml
    β”œβ”€β”€ LICENSE
    β”œβ”€β”€ main.py
    β”œβ”€β”€ params.yaml
    β”œβ”€β”€ requirements.txt
    β”œβ”€β”€ setup.py
    β”œβ”€β”€ template.py
    β”œβ”€β”€ .dockerignore
    β”œβ”€β”€ .dvcignore
    β”œβ”€β”€ artifacts/
    β”‚   β”œβ”€β”€ base_model/
    β”‚   β”‚   β”œβ”€β”€ base_model.h5
    β”‚   β”‚   └── updated_base_model.h5
    β”‚   β”œβ”€β”€ data_ingestion/
    β”‚   β”‚   └── data.zip
    β”‚   β”œβ”€β”€ model_evaluation/
    β”‚   β”‚   └── evaluation_scores.json
    β”‚   └── model_trainer/
    β”‚       β”œβ”€β”€ trained_model.h5
    β”‚       └── model_history/
    β”‚           └── model_history.json
    β”œβ”€β”€ config/
    β”‚   β”œβ”€β”€ config.yaml
    β”‚   β”œβ”€β”€ model.yaml
    β”‚   └── schema.yaml
    β”œβ”€β”€ Research/
    β”‚   └── research.ipynb
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ __init__.py
    β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”œβ”€β”€ __init__.py
    β”‚   β”‚   β”œβ”€β”€ base_model.py
    β”‚   β”‚   β”œβ”€β”€ data_ingestion.py
    β”‚   β”‚   β”œβ”€β”€ model_evaluation.py
    β”‚   β”‚   └── model_trainer.py
    β”‚   β”œβ”€β”€ configuration/
    β”‚   β”‚   β”œβ”€β”€ __init__.py
    β”‚   β”‚   └── configuration.py
    β”‚   β”œβ”€β”€ constants/
    β”‚   β”‚   └── __init__.py
    β”‚   β”œβ”€β”€ entity/
    β”‚   β”‚   β”œβ”€β”€ __init__.py
    β”‚   β”‚   β”œβ”€β”€ artifact_entity.py
    β”‚   β”‚   └── config_entity.py
    β”‚   β”œβ”€β”€ exception/
    β”‚   β”‚   └── __init__.py
    β”‚   β”œβ”€β”€ logger/
    β”‚   β”‚   └── __init__.py
    β”‚   β”œβ”€β”€ pipeline/
    β”‚   β”‚   β”œβ”€β”€ __init__.py
    β”‚   β”‚   β”œβ”€β”€ prediction_pipeline.py
    β”‚   β”‚   └── training_pipeline.py
    β”‚   └── utils/
    β”‚       └── __init__.py
    β”œβ”€β”€ templates/
    β”‚   β”œβ”€β”€ home.html
    β”‚   β”œβ”€β”€ importance.html
    β”‚   └── prediction.html
    β”œβ”€β”€ .dvc/
    β”‚   └── config
    └── .github/
        └── workflows/
            └── main.yaml

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/ArpitKadam/Chest-Cancer-Classification-App.git
cd Chest-Cancer-Classification-App

2. Create and Activate Virtual Environment

conda create -n tensor python=3.10 -y
conda activate tensor

3. Install Dependencies

pip install -r requirements.txt

4. Run Training Pipeline

python main.py

5. Launch Web Application

python app.py

Navigate to: http://127.0.0.1:8080


πŸ“¦ Docker Usage

Build Docker Image

docker build -t arpitkadam/chest-cancer-app:latest .

Run Container

docker run -p 8080:8080 arpitkadam/chest-cancer-app:latest

πŸ’Ύ DVC Workflow

Setup Remote (only once)

dvc remote add -d storage https://dagshub.com/ArpitKadam/Chest-Cancer-Classification-App.dvc

Reproduce pipeline and push data

dvc repro
dvc push

βš™οΈ CI/CD

GitHub Actions configured in .github/workflows/main.yaml for:

  • Linting and testing
  • Pushing data to DAGsHub
  • Auto-retraining (optional)

πŸ§ͺ Model Metrics

Evaluation scores are saved in: artifacts/model_evaluation/evaluation_scores.json

Click to expand/collapse
{
    "loss": 0.5021160244941711,
    "accuracy": 0.7684127163887024
}

πŸ“‚ DVC Tracked Artifacts

  • data_ingestion/data.zip
  • base_model/base_model.h5
  • model_trainer/trained_model.h5
  • model_history/model_history.json
  • model_evaluation/evaluation_scores.json

πŸ“„ License

This project is licensed under the Apache-2.0 license.


✨ Author

Arpit Sachin Kadam


πŸ™Œ Contributions

Contributions are welcome! Please open issues or submit a PR.


πŸ”§ Tech Stack

  • Deep Learning: TensorFlow/Keras, VGG19
  • Web Framework: Flask
  • Data Versioning: DVC
  • MLOps: DAGsHub
  • Containerization: Docker
  • CI/CD: GitHub Actions
  • Frontend: HTML, CSS, JavaScript

πŸ“Š Usage Examples

Command Line Prediction

python main.py

Web Interface

  1. Upload chest X-ray image
  2. Get classification results with confidence scores
  3. View model interpretation and importance maps

🚨 Important Notes

  • Ensure you have sufficient GPU memory for training
  • The model is trained on chest X-ray images - ensure input images are in the correct format
  • For production deployment, consider implementing additional security measures
  • Regular model retraining is recommended as new data becomes available

πŸ“ˆ Future Enhancements

  • Add more cancer types for classification
  • Implement model explainability features (LIME/SHAP)
  • Add user authentication and session management
  • Integrate with medical imaging standards (DICOM)
  • Add batch processing capabilities

About

A full-stack deep learning project that classifies chest X-ray images into various cancer categories using TensorFlow/Keras. It integrates data versioning (DVC), model tracking, Docker, and a Flask-based web interface, with CI/CD workflows through GitHub Actions and remote storage on DAGsHub.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published