# glitchxstar/chest-xray-classifier architecture

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

- Interactive diagram: https://gitdiagram.com/glitchxstar/chest-xray-classifier
- Repository: https://github.com/glitchxstar/chest-xray-classifier

## Overview

This repository is a research-oriented chest X-ray disease classifier with an interactive Gradio interface and uncertainty-aware explanation workflow. A user submits an image; the app predicts disease scores, then can run stochastic dropout passes to estimate saliency and prediction confidence, score explanation reliability, and accept or abstain. Separate modules support dataset preparation, model training, and AUC evaluation. The README is empty, so capability descriptions come from sampled source; training/model internals are only lightly evidenced by the source index.

Main entry points: [`src/config.py`](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/config.py) (Class and thresholds), [`app.py`](https://github.com/glitchxstar/chest-xray-classifier/blob/main/app.py) (Gradio application), [`scripts/evaluate_reliability.py`](https://github.com/glitchxstar/chest-xray-classifier/blob/main/scripts/evaluate_reliability.py) (Reliability evaluation), [`src/model.py`](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/model.py) (Classifier model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Inference"]
  node_app["Gradio application<br/>[app.py]"]
  node_config["Class and thresholds<br/>[config.py]"]
end

subgraph group_explain["Explanation Reliability"]
  node_dropout["MC dropout passes<br/>[uncertainty.py]"]
  node_reliability["Saliency reliability<br/>[reliability.py]"]
  node_gradcam["Grad-CAM utilities<br/>[gradcam.py]"]
end

subgraph group_learning["Model Development"]
  node_dataset["Dataset pipeline<br/>[dataset.py]"]
  node_model["Classifier model<br/>[model.py]"]
  node_loss["Asymmetric loss<br/>[losses.py]"]
  node_training["Model training<br/>[train.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluation["AUC evaluation<br/>[evaluate.py]"]
  node_reliability_eval["Reliability evaluation"]
end

node_user(("Image user"))

node_user -->|"submits image"| node_app
node_app -->|"reads settings"| node_config
node_app -->|"runs passes"| node_dropout
node_app -->|"scores explanation"| node_reliability
node_dataset -->|"reads dimensions"| node_config
node_model -->|"reads settings"| node_config
node_model -->|"uses loss"| node_loss
node_training -->|"uses loss"| node_loss
node_evaluation -->|"reads class metrics"| node_config
node_reliability_eval -->|"runs passes"| node_dropout
node_reliability_eval -->|"scores explanation"| node_reliability
node_reliability_eval -->|"reads thresholds"| node_config

click node_app "https://github.com/glitchxstar/chest-xray-classifier/blob/main/app.py"
click node_config "https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/config.py"
click node_dropout "https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/uncertainty.py"
click node_reliability "https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/reliability.py"
click node_gradcam "https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/gradcam.py"
click node_dataset "https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/dataset.py"
click node_model "https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/model.py"
click node_loss "https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/losses.py"
click node_training "https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/train.py"
click node_evaluation "https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/evaluate.py"
click node_reliability_eval "https://github.com/glitchxstar/chest-xray-classifier/blob/main/scripts/evaluate_reliability.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_app,node_config,node_user toneBlue
class node_dropout,node_reliability,node_gradcam toneAmber
class node_dataset,node_model,node_loss,node_training toneMint
class node_evaluation,node_reliability_eval toneRose
```

## Components

### User Inference

- [Gradio application](https://github.com/glitchxstar/chest-xray-classifier/blob/main/app.py): `app.py`
- [Class and thresholds](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/config.py): `src/config.py`

### Explanation Reliability

- [MC dropout passes](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/uncertainty.py): `src/uncertainty.py`
- [Saliency reliability](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/reliability.py): `src/reliability.py`
- [Grad-CAM utilities](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/gradcam.py): `src/gradcam.py`

### Model Development

- [Dataset pipeline](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/dataset.py): `src/dataset.py`
- [Classifier model](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/model.py): `src/model.py`
- [Asymmetric loss](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/losses.py): `src/losses.py`
- [Model training](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/train.py): `src/train.py`

### Evaluation

- [AUC evaluation](https://github.com/glitchxstar/chest-xray-classifier/blob/main/src/evaluate.py): `src/evaluate.py`
- [Reliability evaluation](https://github.com/glitchxstar/chest-xray-classifier/blob/main/scripts/evaluate_reliability.py): `scripts/evaluate_reliability.py`

### Other components

- **Image user**

## Connections

- Image user → Gradio application: submits image (evidence: `app.py`)
- Gradio application → Class and thresholds: reads settings (evidence: `app.py`)
- Gradio application → MC dropout passes: runs passes (evidence: `app.py`)
- Gradio application → Saliency reliability: scores explanation (evidence: `app.py`)
- Dataset pipeline → Class and thresholds: reads dimensions (evidence: `src/dataset.py`)
- Classifier model → Class and thresholds: reads settings (evidence: `src/model.py`)
- Classifier model → Asymmetric loss: uses loss (evidence: `src/model.py`)
- Model training → Asymmetric loss: uses loss (evidence: `src/train.py`)
- AUC evaluation → Class and thresholds: reads class metrics (evidence: `src/evaluate.py`)
- Reliability evaluation → MC dropout passes: runs passes (evidence: `scripts/evaluate_reliability.py`)
- Reliability evaluation → Saliency reliability: scores explanation (evidence: `scripts/evaluate_reliability.py`)
- Reliability evaluation → Class and thresholds: reads thresholds (evidence: `scripts/evaluate_reliability.py`)
