# dhiraj0-del/galaxai architecture

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

- Interactive diagram: https://gitdiagram.com/dhiraj0-del/galaxai
- Repository: https://github.com/dhiraj0-del/galaxai

## Overview

GALAXAI is a research system for multi-attribute galaxy morphology classification. Its user-facing workflow accepts an uploaded HST image, runs the trained model, and presents morphology predictions; its research workflow prepares multi-task data, trains a CNN, and evaluates results. The graph also retains the documented architecture-comparison objective and legacy pipeline. Source excerpts establish the UI-to-inference and current model/training relationships; unsampled data-preparation and legacy internals are represented conservatively.

Main entry points: [`src/train_multitask.py`](https://github.com/dhiraj0-del/galaxai/blob/main/src/train_multitask.py) (Training orchestration), [`src/models.py`](https://github.com/dhiraj0-del/galaxai/blob/main/src/models.py) (Multi-task CNN), [`src/inference.py`](https://github.com/dhiraj0-del/galaxai/blob/main/src/inference.py) (Image inference), [`src/prepare_multitask_dataset.py`](https://github.com/dhiraj0-del/galaxai/blob/main/src/prepare_multitask_dataset.py) (Dataset preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Image analysis"]
  node_ui["Streamlit interface<br/>[app.py]"]
end

subgraph group_model["Model runtime"]
  node_inference["Image inference<br/>[inference.py]"]
  node_cnn["Multi-task CNN<br/>[models.py]"]
  node_checkpoint["Trained weights"]
end

subgraph group_research["Research workflow"]
  node_dataset["Dataset preparation"]
  node_training["Training orchestration<br/>[train_multitask.py]"]
  node_training_core["Dataset and loss"]
  node_evaluation["Model evaluation<br/>[evaluate_model1.py]"]
  node_weights["Class weights"]
  node_analysis["Target analysis"]
  node_split_check["Split validation"]
end

subgraph group_legacy["Legacy pipeline"]
  node_legacy["Earlier CNN pipeline"]
end

node_user(("Image user"))

node_user -->|"uploads image"| node_ui
node_ui -->|"requests predictions"| node_inference
node_inference -->|"runs model"| node_cnn
node_inference -->|"loads weights"| node_checkpoint
node_training -->|"trains model"| node_cnn
node_training -->|"uses training utilities"| node_training_core
node_evaluation -->|"evaluates model"| node_cnn
node_evaluation -->|"uses dataset utilities"| node_training_core
node_dataset -.->|"supplies dataset"| node_training
node_weights -.->|"supplies weights"| node_training
node_analysis -.->|"analyzes targets"| node_dataset
node_split_check -.->|"checks splits"| node_dataset
node_legacy -.->|"uses earlier models"| node_cnn

click node_ui "https://github.com/dhiraj0-del/galaxai/blob/main/app.py"
click node_inference "https://github.com/dhiraj0-del/galaxai/blob/main/src/inference.py"
click node_cnn "https://github.com/dhiraj0-del/galaxai/blob/main/src/models.py"
click node_checkpoint "https://github.com/dhiraj0-del/galaxai/blob/main/checkpoints/galaxai_model1_v2_best.pth"
click node_dataset "https://github.com/dhiraj0-del/galaxai/blob/main/src/prepare_multitask_dataset.py"
click node_training "https://github.com/dhiraj0-del/galaxai/blob/main/src/train_multitask.py"
click node_training_core "https://github.com/dhiraj0-del/galaxai/blob/main/src/multitask_training.py"
click node_evaluation "https://github.com/dhiraj0-del/galaxai/blob/main/src/evaluate_model1.py"
click node_weights "https://github.com/dhiraj0-del/galaxai/blob/main/src/calculate_class_weights.py"
click node_analysis "https://github.com/dhiraj0-del/galaxai/blob/main/src/analyze_10_targets.py"
click node_split_check "https://github.com/dhiraj0-del/galaxai/blob/main/src/check_multitask_splits.py"
click node_legacy "https://github.com/dhiraj0-del/galaxai/tree/main/archive/old_pipeline"

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_ui,node_user toneBlue
class node_inference,node_cnn,node_checkpoint toneAmber
class node_dataset,node_training,node_training_core,node_evaluation,node_weights,node_analysis,node_split_check toneMint
class node_legacy toneRose
```

## Components

### Image analysis

- [Streamlit interface](https://github.com/dhiraj0-del/galaxai/blob/main/app.py): `app.py`

### Model runtime

- [Image inference](https://github.com/dhiraj0-del/galaxai/blob/main/src/inference.py): `src/inference.py`
- [Multi-task CNN](https://github.com/dhiraj0-del/galaxai/blob/main/src/models.py): `src/models.py`
- [Trained weights](https://github.com/dhiraj0-del/galaxai/blob/main/checkpoints/galaxai_model1_v2_best.pth): `checkpoints/galaxai_model1_v2_best.pth`

### Research workflow

- [Dataset preparation](https://github.com/dhiraj0-del/galaxai/blob/main/src/prepare_multitask_dataset.py): `src/prepare_multitask_dataset.py`
- [Training orchestration](https://github.com/dhiraj0-del/galaxai/blob/main/src/train_multitask.py): `src/train_multitask.py`
- [Dataset and loss](https://github.com/dhiraj0-del/galaxai/blob/main/src/multitask_training.py): `src/multitask_training.py`
- [Model evaluation](https://github.com/dhiraj0-del/galaxai/blob/main/src/evaluate_model1.py): `src/evaluate_model1.py`
- [Class weights](https://github.com/dhiraj0-del/galaxai/blob/main/src/calculate_class_weights.py): `src/calculate_class_weights.py`
- [Target analysis](https://github.com/dhiraj0-del/galaxai/blob/main/src/analyze_10_targets.py): `src/analyze_10_targets.py`
- [Split validation](https://github.com/dhiraj0-del/galaxai/blob/main/src/check_multitask_splits.py): `src/check_multitask_splits.py`

### Legacy pipeline

- [Earlier CNN pipeline](https://github.com/dhiraj0-del/galaxai/tree/main/archive/old_pipeline): `archive/old_pipeline`

### Other components

- **Image user**

## Connections

- Image user → Streamlit interface: uploads image (evidence: `README.md`)
- Streamlit interface → Image inference: requests predictions (evidence: `app.py`)
- Image inference → Multi-task CNN: runs model (evidence: `src/inference.py`)
- Image inference → Trained weights: loads weights (evidence: `src/inference.py`)
- Training orchestration → Multi-task CNN: trains model (evidence: `src/train_multitask.py`)
- Training orchestration → Dataset and loss: uses training utilities (evidence: `src/train_multitask.py`)
- Model evaluation → Multi-task CNN: evaluates model (evidence: `src/evaluate_model1.py`)
- Model evaluation → Dataset and loss: uses dataset utilities (evidence: `src/evaluate_model1.py`)
- Dataset preparation → Training orchestration: supplies dataset
- Class weights → Training orchestration: supplies weights
- Target analysis → Dataset preparation: analyzes targets
- Split validation → Dataset preparation: checks splits
- Earlier CNN pipeline → Multi-task CNN: uses earlier models (evidence: `archive/old_pipeline/train.py`)
