# akash-c17/echolv-xai architecture

> Architecture diagram of the GitHub repository akash-c17/echolv-xai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akash-c17/echolv-xai
- Repository: https://github.com/akash-c17/echolv-xai

## Overview

EchoLV-XAI is an experimental echocardiography research prototype: it segments the left ventricle, compares full-image, cropped-ROI, and masked-image classification, and evaluates anatomical focus with explainability methods. Its documented user-facing path is an interactive Streamlit application backed by an inference pipeline; training, dataset preparation, feature analysis, and experiment evaluation are separate research workflows. The pipeline and selected helpers are excerpted; other capabilities and links below rely on README statements and the source index, not inspection of their implementation.

Main entry points: [`src/pipeline.py`](https://github.com/akash-c17/echolv-xai/blob/main/src/pipeline.py) (Inference pipeline), [`src/classification/inference.py`](https://github.com/akash-c17/echolv-xai/blob/main/src/classification/inference.py) (CNN classification), [`src/segmentation/inference.py`](https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/inference.py) (LV segmentation), [`src/classification/dataset.py`](https://github.com/akash-c17/echolv-xai/blob/main/src/classification/dataset.py) (Classification dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_dataset["Dataset loading<br/>[dataset_loader.py]"]
  node_validation["Dataset validation"]
  node_splits["Patient-level splits<br/>[split_dataset.py]"]
  node_clsdata["Classification dataset<br/>[dataset.py]"]
end

subgraph group_models["Modeling and inference"]
  node_pipeline["Inference pipeline<br/>[pipeline.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_preprocess["Image preprocessing"]
  node_segtrain["Segmentation training<br/>[train.py]"]
  node_segmentation["LV segmentation<br/>[inference.py]"]
  node_unet["U-Net models<br/>[unet.py]"]
  node_unetpp["U-Net++ model<br/>[unetplusplus.py]"]
  node_roi["ROI and masking<br/>[roi_processing.py]"]
  node_clstrain["Classification training<br/>[train.py]"]
  node_classifier["CNN classification<br/>[inference.py]"]
  node_clsmodels["Classifier models<br/>[models.py]"]
end

subgraph group_explain["Explainability"]
  node_gradcam["Grad-CAM<br/>[gradcam.py]"]
  node_shap["SHAP attribution<br/>[shap_explainer.py]"]
  node_xai_visuals["XAI visualization<br/>[visualization.py]"]
end

subgraph group_analysis["Research analysis"]
  node_features["Feature extraction<br/>[extractor.py]"]
  node_feature_analysis["Embedding analysis"]
  node_seg_eval["Segmentation evaluation<br/>[evaluate.py]"]
  node_cls_eval["Classification evaluation<br/>[evaluate.py]"]
  node_metrics["Evaluation metrics"]
  node_comparison["Experiment comparison"]
end

subgraph group_interface["User interface"]
  node_streamlit["Streamlit app<br/>[streamlit_app.py]"]
end

node_user(("Research user"))

node_user -->|"uses"| node_streamlit
node_streamlit -.->|"runs inference"| node_pipeline
node_pipeline -->|"loads settings"| node_config
node_pipeline -->|"predicts mask"| node_segmentation
node_pipeline -->|"extracts ROI"| node_roi
node_pipeline -->|"predicts class"| node_classifier
node_pipeline -->|"generates attribution"| node_gradcam
node_pipeline -->|"renders overlay"| node_xai_visuals
node_segmentation -->|"mask guides ROI"| node_roi
node_unet -.->|"segments LV"| node_segmentation
node_unetpp -.->|"segments LV"| node_segmentation
node_dataset -.->|"validates data"| node_validation
node_dataset -->|"prepares splits"| node_splits
node_preprocess -->|"prepares images"| node_segmentation
node_segtrain -.->|"trains model"| node_unet
node_segtrain -.->|"trains model"| node_unetpp
node_clstrain -.->|"trains on"| node_clsdata
node_clsdata -.->|"supplies images"| node_classifier
node_clsmodels -->|"implements CNN"| node_classifier
node_roi -->|"supplies crop or mask"| node_classifier
node_classifier -->|"explained by"| node_gradcam
node_classifier -->|"analyzed by"| node_shap
node_clsdata -->|"provides samples"| node_features
node_clsmodels -->|"extracts embeddings"| node_features
node_features -->|"analyzes embeddings"| node_feature_analysis
node_segmentation -.->|"evaluates masks"| node_seg_eval
node_classifier -.->|"evaluates predictions"| node_cls_eval
node_cls_eval -.->|"computes scores"| node_metrics
node_cls_eval -.->|"compares modes"| node_comparison
node_gradcam -.->|"visualizes heatmap"| node_xai_visuals

click node_streamlit "https://github.com/akash-c17/echolv-xai/blob/main/app/streamlit_app.py"
click node_pipeline "https://github.com/akash-c17/echolv-xai/blob/main/src/pipeline.py"
click node_config "https://github.com/akash-c17/echolv-xai/blob/main/src/utils/config.py"
click node_dataset "https://github.com/akash-c17/echolv-xai/blob/main/src/data/dataset_loader.py"
click node_validation "https://github.com/akash-c17/echolv-xai/blob/main/src/data/dataset_validator.py"
click node_splits "https://github.com/akash-c17/echolv-xai/blob/main/src/data/split_dataset.py"
click node_preprocess "https://github.com/akash-c17/echolv-xai/blob/main/src/preprocessing/image_preprocessing.py"
click node_segtrain "https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/train.py"
click node_segmentation "https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/inference.py"
click node_unet "https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/unet.py"
click node_unetpp "https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/unetplusplus.py"
click node_roi "https://github.com/akash-c17/echolv-xai/blob/main/src/preprocessing/roi_processing.py"
click node_clstrain "https://github.com/akash-c17/echolv-xai/blob/main/src/classification/train.py"
click node_clsdata "https://github.com/akash-c17/echolv-xai/blob/main/src/classification/dataset.py"
click node_classifier "https://github.com/akash-c17/echolv-xai/blob/main/src/classification/inference.py"
click node_clsmodels "https://github.com/akash-c17/echolv-xai/blob/main/src/classification/models.py"
click node_gradcam "https://github.com/akash-c17/echolv-xai/blob/main/src/explainability/gradcam.py"
click node_shap "https://github.com/akash-c17/echolv-xai/blob/main/src/explainability/shap_explainer.py"
click node_xai_visuals "https://github.com/akash-c17/echolv-xai/blob/main/src/explainability/visualization.py"
click node_features "https://github.com/akash-c17/echolv-xai/blob/main/src/features/extractor.py"
click node_feature_analysis "https://github.com/akash-c17/echolv-xai/blob/main/src/features/feature_analysis.py"
click node_seg_eval "https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/evaluate.py"
click node_cls_eval "https://github.com/akash-c17/echolv-xai/blob/main/src/classification/evaluate.py"
click node_metrics "https://github.com/akash-c17/echolv-xai/blob/main/src/evaluation/classification_metrics.py"
click node_comparison "https://github.com/akash-c17/echolv-xai/blob/main/src/evaluation/experiment_comparison.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset,node_validation,node_splits,node_clsdata,node_user toneBlue
class node_pipeline,node_config,node_preprocess,node_segtrain,node_segmentation,node_unet,node_unetpp,node_roi,node_clstrain,node_classifier,node_clsmodels toneAmber
class node_gradcam,node_shap,node_xai_visuals toneMint
class node_features,node_feature_analysis,node_seg_eval,node_cls_eval,node_metrics,node_comparison toneRose
class node_streamlit toneIndigo
```

## Components

### Data preparation

- [Dataset loading](https://github.com/akash-c17/echolv-xai/blob/main/src/data/dataset_loader.py): `src/data/dataset_loader.py`
- [Dataset validation](https://github.com/akash-c17/echolv-xai/blob/main/src/data/dataset_validator.py): `src/data/dataset_validator.py`
- [Patient-level splits](https://github.com/akash-c17/echolv-xai/blob/main/src/data/split_dataset.py): `src/data/split_dataset.py`
- [Classification dataset](https://github.com/akash-c17/echolv-xai/blob/main/src/classification/dataset.py): `src/classification/dataset.py`

### Modeling and inference

- [Inference pipeline](https://github.com/akash-c17/echolv-xai/blob/main/src/pipeline.py): `src/pipeline.py`
- [Configuration](https://github.com/akash-c17/echolv-xai/blob/main/src/utils/config.py): `src/utils/config.py`
- [Image preprocessing](https://github.com/akash-c17/echolv-xai/blob/main/src/preprocessing/image_preprocessing.py): `src/preprocessing/image_preprocessing.py`
- [Segmentation training](https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/train.py): `src/segmentation/train.py`
- [LV segmentation](https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/inference.py): `src/segmentation/inference.py`
- [U-Net models](https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/unet.py): `src/segmentation/unet.py`
- [U-Net++ model](https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/unetplusplus.py): `src/segmentation/unetplusplus.py`
- [ROI and masking](https://github.com/akash-c17/echolv-xai/blob/main/src/preprocessing/roi_processing.py): `src/preprocessing/roi_processing.py`
- [Classification training](https://github.com/akash-c17/echolv-xai/blob/main/src/classification/train.py): `src/classification/train.py`
- [CNN classification](https://github.com/akash-c17/echolv-xai/blob/main/src/classification/inference.py): `src/classification/inference.py`
- [Classifier models](https://github.com/akash-c17/echolv-xai/blob/main/src/classification/models.py): `src/classification/models.py`

### Explainability

- [Grad-CAM](https://github.com/akash-c17/echolv-xai/blob/main/src/explainability/gradcam.py): `src/explainability/gradcam.py`
- [SHAP attribution](https://github.com/akash-c17/echolv-xai/blob/main/src/explainability/shap_explainer.py): `src/explainability/shap_explainer.py`
- [XAI visualization](https://github.com/akash-c17/echolv-xai/blob/main/src/explainability/visualization.py): `src/explainability/visualization.py`

### Research analysis

- [Feature extraction](https://github.com/akash-c17/echolv-xai/blob/main/src/features/extractor.py): `src/features/extractor.py`
- [Embedding analysis](https://github.com/akash-c17/echolv-xai/blob/main/src/features/feature_analysis.py): `src/features/feature_analysis.py`
- [Segmentation evaluation](https://github.com/akash-c17/echolv-xai/blob/main/src/segmentation/evaluate.py): `src/segmentation/evaluate.py`
- [Classification evaluation](https://github.com/akash-c17/echolv-xai/blob/main/src/classification/evaluate.py): `src/classification/evaluate.py`
- [Evaluation metrics](https://github.com/akash-c17/echolv-xai/blob/main/src/evaluation/classification_metrics.py): `src/evaluation/classification_metrics.py`
- [Experiment comparison](https://github.com/akash-c17/echolv-xai/blob/main/src/evaluation/experiment_comparison.py): `src/evaluation/experiment_comparison.py`

### User interface

- [Streamlit app](https://github.com/akash-c17/echolv-xai/blob/main/app/streamlit_app.py): `app/streamlit_app.py`

### Other components

- **Research user**

## Connections

- Research user → Streamlit app: uses
- Streamlit app → Inference pipeline: runs inference
- Inference pipeline → Configuration: loads settings (evidence: `src/pipeline.py`)
- Inference pipeline → LV segmentation: predicts mask (evidence: `src/pipeline.py`)
- Inference pipeline → ROI and masking: extracts ROI (evidence: `src/pipeline.py`)
- Inference pipeline → CNN classification: predicts class (evidence: `src/pipeline.py`)
- Inference pipeline → Grad-CAM: generates attribution (evidence: `src/pipeline.py`)
- Inference pipeline → XAI visualization: renders overlay (evidence: `src/pipeline.py`)
- LV segmentation → ROI and masking: mask guides ROI
- U-Net models → LV segmentation: segments LV
- U-Net++ model → LV segmentation: segments LV
- Dataset loading → Dataset validation: validates data
- Dataset loading → Patient-level splits: prepares splits
- Image preprocessing → LV segmentation: prepares images
- Segmentation training → U-Net models: trains model
- Segmentation training → U-Net++ model: trains model
- Classification training → Classification dataset: trains on
- Classification dataset → CNN classification: supplies images
- Classifier models → CNN classification: implements CNN
- ROI and masking → CNN classification: supplies crop or mask
- CNN classification → Grad-CAM: explained by
- CNN classification → SHAP attribution: analyzed by
- Classification dataset → Feature extraction: provides samples (evidence: `src/features/extractor.py`)
- Classifier models → Feature extraction: extracts embeddings (evidence: `src/features/extractor.py`)
- Feature extraction → Embedding analysis: analyzes embeddings
- LV segmentation → Segmentation evaluation: evaluates masks
- CNN classification → Classification evaluation: evaluates predictions
- Classification evaluation → Evaluation metrics: computes scores
- Classification evaluation → Experiment comparison: compares modes
- Grad-CAM → XAI visualization: visualizes heatmap
