# yash-vks-chauhan/ct-denoising-u-net architecture

> Architecture diagram of the GitHub repository yash-vks-chauhan/ct-denoising-u-net, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yash-vks-chauhan/ct-denoising-u-net
- Repository: https://github.com/yash-vks-chauhan/ct-denoising-u-net

## Overview

##### Project Type & Purpose
- This project is a deep learning-based image processing system focused on denoising lung CT scans and X-ray images.
- It includes a U-Net model implementation built with TensorFlow/Keras, accompanied by a preprocessing pipeline, model training (via train.py), evaluation metrics (PSNR, SSIM), and even a notebook-based exploration.

##### Analyzing the File Structure
- Key files and directories include:
- README.md: Provides an overview of the project, features, and instructions.
- train.py: The training script that initiates model training.
- denoising_model.h5 & denoising_metrics.csv: Represent the trained model and evaluation metrics respectively.
- notebooks folder: Contains Jupyter notebooks for testing and training analysis.
- are folder: Contains sample images such as lung_images.png.
- GitHub workflow files under .github: Show CI/CD integrations (e.g., pylint for code quality).

##### Main Components
- Data Input and Dataset Handling:
- Inputs include CT scans from various datasets (e.g., COVID-19 Radiography, NIH Chest X-ray).
- Separate input folders for “Noisy” and “Clean” images, as mentioned in the README.
- Preprocessing Pipeline:
- Steps like grayscale conversion, resizing, normalization, CLAHE, augmentation, and possibly super-resolution modifications.
- Conversion of raw images into a standardized format for training.
- U-Net Denoising Model:
- Core deep learning model architecture which consists of:
- Encoder (series of convolutional layers)
- Bottleneck (capturing noise patterns)
- Decoder (reconstruction of denoised images)
- Training Process:
- Training inputs (paired noisy and clean images) feed into the model.
- Visualization components, such as the training history and evaluation curves (loss, MAE) that are recorded.
- Model output (denoising_model.h5) and metrics (denoising_metrics.csv).
- Inference and Evaluation:
- Steps where inference.py may be used for processing new images.
- Evaluation metrics computation for PSNR and SSIM.
- Validation pipeline confirmation using augmented vs. original image consistency.

##### Relationships & Interactions
- From raw image data entering the preprocessor.
- From the preprocessed dataset feeding into the U-Net model training.
- From the training pipeline towards evaluation metrics and model output.
- Interactions between batch data generators (as mentioned in the README) and GPU computations for accelerated training.

##### Architectural Patterns & Technology Stack
- Clearly delineate the separation between data handling (preprocessing, augmentation) and model architecture (encoder, bottleneck, decoder).
- Use of TensorFlow/Keras for deep learning and note that GPU acceleration is leveraged.
- Mention the use of custom data generators for efficient memory management.
- CI/CD integration shown by the .github/workflows configuration which ensures code quality.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Project Overview"
        A["Project Overview & Documentation"]:::doc
    end

    subgraph "Data Handling"
        B["Data Input & Sample Images"]:::data
        C["Preprocessing Pipeline"]:::preprocess
        B -->|"preprocessed"| C
    end

    subgraph "U-Net Denoising Model"
        D1["Encoder"]:::model
        D2["Bottleneck"]:::model
        D3["Decoder"]:::model
        D1 -->|"flow"| D2
        D2 -->|"flow"| D3
    end

    subgraph "Training Process"
        E["Training Script (train.py)"]:::train
        F["Trained Model (denoising_model.h5)"]:::train
        G["Evaluation Metrics (denoising_metrics.csv)"]:::eval
        E -->|"trains"| D1
        D3 -->|"features passed"| E
        E -->|"saves"| F
        E -->|"outputs"| G
    end

    subgraph "Additional Components"
        H["Notebook-based Exploration"]:::notebook
        I["CI/CD Integration"]:::ci
    end

    %% Overall Flow
    A -->|"defines requirements"| B
    C -->|"feeds processed data"| D1
    E -->|"analysis"| H
    E -->|"validated by"| I

    %% Click Events
    click A "https://github.com/yash-vks-chauhan/ct-denoising-u-net/blob/main/README.md"
    click B "https://github.com/yash-vks-chauhan/ct-denoising-u-net/tree/main/are"
    click E "https://github.com/yash-vks-chauhan/ct-denoising-u-net/blob/main/train.py"
    click F "https://github.com/yash-vks-chauhan/ct-denoising-u-net/blob/main/denoising_model.h5"
    click G "https://github.com/yash-vks-chauhan/ct-denoising-u-net/blob/main/denoising_metrics.csv"
    click H "https://github.com/yash-vks-chauhan/ct-denoising-u-net/tree/main/notebooks"
    click I "https://github.com/yash-vks-chauhan/ct-denoising-u-net/blob/main/.github/workflows/pylint.yml"

    %% Styles
    classDef doc fill:#ffebcd,stroke:#8B4513,stroke-width:2px;
    classDef data fill:#e0ffff,stroke:#008b8b,stroke-width:2px;
    classDef preprocess fill:#f0e68c,stroke:#daa520,stroke-width:2px;
    classDef model fill:#98fb98,stroke:#2e8b57,stroke-width:2px;
    classDef train fill:#ffa07a,stroke:#ff4500,stroke-width:2px;
    classDef eval fill:#add8e6,stroke:#00008b,stroke-width:2px;
    classDef notebook fill:#ffe4e1,stroke:#ff69b4,stroke-width:2px;
    classDef ci fill:#e6e6fa,stroke:#9370db,stroke-width:2px;
```
