How mohammad-raselr/kidney-disease-classification-deep-learning-project works
1. This repository is a config-driven deep learning system for kidney-disease image classification. The core application code lives under src/cnnClassifier, while research/ holds one-off notebooks used to prototype and validate each stage.
2. The project is structured as a multi-stage ML pipeline rather than a single training script. The main pipeline stages are split into data_ingestion, prepare_base_model, model_training, and model_evolution_mlflow, with matching wrappers in src/cnnClassifier/pipeline/.
3. The central data flow is: raw dataset acquisition and organization → train/validation splitting and preprocessing → transfer-learning base model setup → model training/fine-tuning → evaluation and experiment logging. The trained artifact is persisted as model/trained_model.h5.
4. Configuration is separated from code. config/config.yaml and params.yaml define runtime and model parameters, while src/cnnClassifier/entity/config_entity.py and src/cnnClassifier/config/configuration.py translate those files into typed objects used by the pipeline.
5. src/cnnClassifier/components/ contains the actual business logic for each stage. This is the main boundary where data engineering, model construction, and training behavior are implemented. src/cnnClassifier/utils/common.py likely provides shared helpers such as file handling, downloads, and config utilities.
6. The project uses DVC to orchestrate and version the pipeline. dvc.yaml, dvc.lock, and .dvc/ indicate that pipeline execution and artifact lineage are intended to be reproducible, with dvc repro and dvc dag as the operational entry points.
7. MLflow is used for experiment tracking, and the README shows DagsHub as the remote MLflow backend. This means model runs, metrics, and tags are not only local but can be synchronized to an external tracking service.
8. There are two likely runtime surfaces: main.py for training/orchestration and app.py plus templates/index.html for inference via a small web UI. That UI boundary is separate from the training pipeline and probably consumes the saved model artifact rather than retraining.
9. Deployment is container-based. The root Dockerfile packages the application, and .github/workflows/main.yaml automates CI/CD to AWS ECR and EC2. The README describes a GitHub Actions flow that builds the image, pushes it to ECR, and runs it on an EC2 host.
10. The repository includes packaging outputs and install metadata (setup.py, dist/, build/, src/cnnClassifier.egg-info/), which indicates the codebase is meant to be installable as a Python package and reused across scripts, pipelines, and deployment targets.
11. logs/running_logs.log suggests the pipeline emits local operational logs, which is important for debugging stage transitions and failures in long-running training jobs.
12. Overall, the architecture is a classic ML lifecycle split into three planes: experimentation in notebooks, reproducible pipeline execution in src/cnnClassifier + DVC, and production delivery through a web app container deployed via GitHub Actions to AWS.
Main entry points: config_entity.py Config entity · model_training.py Model training · model_evolution_mlflow.py MLflow logging · research Research notebooks
Components 22
Experimentation
One-off notebooks used to prototype and validate pipeline stages
- Research notebooks · Stage prototypes and validation experiments
research
ML Pipeline
Reproducible training and evaluation flow implemented in source code
- DVC pipeline · Reproducible multi-stage pipeline definition
dvc.yaml - Main entry · Training orchestration entry point
main.py - Ingest stage · Wrapper for data ingestion
src/cnnClassifier/pipeline/stage_01_data_ingestion.py - Base model stage · Wrapper for transfer-learning setup
src/cnnClassifier/pipeline/stage_02_prepare_base_model.py - Training stage · Wrapper for model training
src/cnnClassifier/pipeline/stage_03_model_training.py - MLflow stage · Wrapper for experiment logging and evaluation
src/cnnClassifier/pipeline/stage_04_model_evolution_mlflow.py - Data ingestion · Acquires and organizes raw dataset
src/cnnClassifier/components/data_ingestion.py - Base model · Builds the transfer-learning backbone
src/cnnClassifier/components/prepare_base_model.py - Model training · Fits and fine-tunes the classifier
src/cnnClassifier/components/model_training.py - MLflow logging · Evaluates runs and records metrics/artifacts
src/cnnClassifier/components/model_evolution_mlflow.py - Trained model · Persisted Keras model artifact
model/trained_model.h5
Config
Typed configuration and shared utilities that drive the pipeline
- Config YAML · Runtime and pipeline configuration
config/config.yaml - Params YAML · Model and training hyperparameters
params.yaml - Config entity · Typed configuration objects
src/cnnClassifier/entity/config_entity.py - Configuration · Translates YAML into usable config objects
src/cnnClassifier/config/configuration.py - Common utils · Shared file, download, and config utilities
src/cnnClassifier/utils/common.py
Delivery
Web inference and containerized deployment surface
- Prediction · Loads saved model for serving-time inference
src/cnnClassifier/pipeline/prediction.py - Web app · Inference UI and request handling
app.py - UI template · Frontend template for the inference page
templates/index.html - Dockerfile · Packages the application for container deployment
Dockerfile - GitHub Actions · Builds, pushes, and deploys the container
.github/workflows/main.yaml
Connections 34
- Research notebooks → Data ingestion: prototype · Notebook experiments validate the ingestion stage
- Research notebooks → Base model: prototype · Notebook experiments validate the base-model stage
- Research notebooks → Model training: prototype · Notebook experiments validate the training stage
- Research notebooks → MLflow logging: prototype · Notebook experiments validate the logging stage
- DVC pipeline → Ingest stage: orchestrates · DVC tracks the ingestion stage
- DVC pipeline → Base model stage: orchestrates · DVC tracks the base-model stage
- DVC pipeline → Training stage: orchestrates · DVC tracks the training stage
- DVC pipeline → MLflow stage: orchestrates · DVC tracks the MLflow stage
- Main entry → Ingest stage: runs · Main entry executes ingestion first
- Main entry → Base model stage: runs · Main entry executes base-model setup
- Main entry → Training stage: runs · Main entry executes training next
- Main entry → MLflow stage: runs · Main entry executes experiment logging last
- Config YAML → Configuration: loads · Runtime config is parsed into configuration objects
- Params YAML → Configuration: loads · Model parameters are parsed into configuration objects
- Configuration → Config entity: types · Configuration layer produces typed entities
- Common utils → Data ingestion: supports · Shared helpers support file and data handling
- Common utils → Base model: supports · Shared helpers support model setup
- Common utils → Model training: supports · Shared helpers support training workflows
- Common utils → MLflow logging: supports · Shared helpers support logging and artifact handling
- Config entity → Data ingestion: feeds · Typed config drives ingestion
- Config entity → Base model: feeds · Typed config drives base-model preparation
- Config entity → Model training: feeds · Typed config drives training
- Config entity → MLflow logging: feeds · Typed config drives evaluation and tracking
- Ingest stage → Data ingestion: invokes · Stage wrapper delegates to ingestion component
- Base model stage → Base model: invokes · Stage wrapper delegates to base-model component
- Training stage → Model training: invokes · Stage wrapper delegates to training component
- MLflow stage → MLflow logging: invokes · Stage wrapper delegates to MLflow component
- Model training → Trained model: persists · Training writes the final model artifact
- MLflow logging → Trained model: evaluates · Logged evaluation uses the trained artifact
- Prediction → Trained model: loads · Inference code consumes the saved model
- Web app → Prediction: serves · Web app routes requests to prediction logic
- Web app → UI template: renders · Web app uses the UI template
- GitHub Actions → Dockerfile: builds · CI/CD builds the container image
- GitHub Actions → Web app: deploys · Workflow deploys the app container