# johnskouloudis/cnn_project architecture

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

- Interactive diagram: https://gitdiagram.com/johnskouloudis/cnn_project
- Repository: https://github.com/johnskouloudis/cnn_project

## Overview

This repository is a coursework project for classifying chest X-rays into four categories. Its main workflow loads and transforms labeled images, splits them into training, validation, and test sets, trains one of several CNN or ResNet50 alternatives, then reports test metrics and displays a confusion matrix. It also supports dataset exploration and includes a standalone custom BasicBlock bonus implementation. The scripts and README establish the workflows; the graph does not imply that the bonus block is used by ResNet50.

Main entry points: [`train_test_functions.py`](https://github.com/johnskouloudis/cnn_project/blob/main/train_test_functions.py) (Train and test helpers), [`COVID19Dataset.py`](https://github.com/johnskouloudis/cnn_project/blob/main/COVID19Dataset.py) (Dataset and exploration), [`CNN1.py`](https://github.com/johnskouloudis/cnn_project/blob/main/CNN1.py) (CNN1 workflow), [`CNN2.py`](https://github.com/johnskouloudis/cnn_project/blob/main/CNN2.py) (CNN2 workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data"]
  node_image_dataset[("X-ray image folders")]
  node_dataset["Dataset and exploration<br/>[COVID19Dataset.py]"]
end

subgraph group_models["Classification"]
  node_cnn1["CNN1 workflow<br/>[CNN1.py]"]
  node_cnn2["CNN2 workflow<br/>[CNN2.py]"]
  node_resnet["ResNet50 workflow<br/>[ResNet50.py]"]
end

subgraph group_evaluation["Training and evaluation"]
  node_train_eval["Train and test helpers"]
end

subgraph group_bonus["Bonus model component"]
  node_basic_block["Custom BasicBlock<br/>[BasicBlock.py]"]
end

node_user(("Course user"))

node_user -->|"explores data"| node_dataset
node_user -->|"runs task"| node_cnn1
node_user -->|"runs task"| node_cnn2
node_user -->|"chooses mode"| node_resnet
node_image_dataset -->|"provides images"| node_dataset
node_cnn1 -->|"loads and splits"| node_dataset
node_cnn2 -->|"loads and splits"| node_dataset
node_resnet -->|"loads and splits"| node_dataset
node_cnn1 -->|"trains and tests"| node_train_eval
node_cnn2 -->|"trains and tests"| node_train_eval
node_resnet -->|"trains and tests"| node_train_eval
node_train_eval -->|"runs model"| node_cnn1
node_train_eval -->|"runs model"| node_cnn2
node_train_eval -->|"runs model"| node_resnet

click node_dataset "https://github.com/johnskouloudis/cnn_project/blob/main/COVID19Dataset.py"
click node_cnn1 "https://github.com/johnskouloudis/cnn_project/blob/main/CNN1.py"
click node_cnn2 "https://github.com/johnskouloudis/cnn_project/blob/main/CNN2.py"
click node_resnet "https://github.com/johnskouloudis/cnn_project/blob/main/ResNet50.py"
click node_train_eval "https://github.com/johnskouloudis/cnn_project/blob/main/train_test_functions.py"
click node_basic_block "https://github.com/johnskouloudis/cnn_project/blob/main/BasicBlock.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_image_dataset,node_dataset,node_user toneBlue
class node_cnn1,node_cnn2,node_resnet toneAmber
class node_train_eval toneMint
class node_basic_block toneRose
```

## Components

### Data

- **X-ray image folders**
- [Dataset and exploration](https://github.com/johnskouloudis/cnn_project/blob/main/COVID19Dataset.py): `COVID19Dataset.py`

### Classification

- [CNN1 workflow](https://github.com/johnskouloudis/cnn_project/blob/main/CNN1.py): `CNN1.py`
- [CNN2 workflow](https://github.com/johnskouloudis/cnn_project/blob/main/CNN2.py): `CNN2.py`
- [ResNet50 workflow](https://github.com/johnskouloudis/cnn_project/blob/main/ResNet50.py): `ResNet50.py`

### Training and evaluation

- [Train and test helpers](https://github.com/johnskouloudis/cnn_project/blob/main/train_test_functions.py): `train_test_functions.py`

### Bonus model component

- [Custom BasicBlock](https://github.com/johnskouloudis/cnn_project/blob/main/BasicBlock.py): `BasicBlock.py`

### Other components

- **Course user**

## Connections

- Course user → Dataset and exploration: explores data (evidence: `README.md`)
- Course user → CNN1 workflow: runs task (evidence: `README.md`)
- Course user → CNN2 workflow: runs task (evidence: `README.md`)
- Course user → ResNet50 workflow: chooses mode (evidence: `README.md`)
- X-ray image folders → Dataset and exploration: provides images (evidence: `COVID19Dataset.py`)
- CNN1 workflow → Dataset and exploration: loads and splits (evidence: `CNN1.py`)
- CNN2 workflow → Dataset and exploration: loads and splits (evidence: `CNN2.py`)
- ResNet50 workflow → Dataset and exploration: loads and splits (evidence: `ResNet50.py`)
- CNN1 workflow → Train and test helpers: trains and tests (evidence: `CNN1.py`)
- CNN2 workflow → Train and test helpers: trains and tests (evidence: `CNN2.py`)
- ResNet50 workflow → Train and test helpers: trains and tests (evidence: `ResNet50.py`)
- Train and test helpers → CNN1 workflow: runs model (evidence: `train_test_functions.py`)
- Train and test helpers → CNN2 workflow: runs model (evidence: `train_test_functions.py`)
- Train and test helpers → ResNet50 workflow: runs model (evidence: `train_test_functions.py`)
