# allen-utec/cnn architecture

> Architecture diagram of the GitHub repository allen-utec/cnn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/allen-utec/cnn
- Repository: https://github.com/allen-utec/cnn

## Overview

##### Project’s type and purpose
- This is a machine-learning/data-science project—a CNN-based image classifier for COVID-19 radiography images.
- The README confirms it uses a publicly available Kaggle dataset of four X-ray categories and applies a deep-learning model (PyTorch CNN) to perform classification.

##### File structure
- Top-level files:
- proyecto3.pdf (final report)
- Multiple Jupyter notebooks (proyecto3_introduction.ipynb, proyecto3_experimento_*.ipynb) for data exploration, model training, and experiments.
- pytorchtools.py (helper utilities for training, e.g., early stopping)
- utils.py (data-loading and preprocessing functions)
- README.md, .gitignore
- There are no separate “frontend” or “backend” directories—this is a single‐pipeline data science workflow.
- Key patterns:
- Data ingestion & preprocessing modules in utils.py
- Training utilities in pytorchtools.py
- Experiment orchestration in notebooks

##### README for additional insights
- Confirms classification of four categories of chest X-rays
- Points to the dataset URL

a. Main components:
1. Data Source (Kaggle dataset)
2. Data Ingestion & Preprocessing (utils.py)
3. Model Definition (CNN implemented in notebooks + helper in pytorchtools.py)
4. Training Loop & Callbacks (pytorchtools.py: early stopping, checkpointing)
5. Experiment Controller (each Jupyter notebook)
6. Evaluation & Visualization (plots, metrics in notebooks)
7. Output Artifacts (trained model files, logs, figures, proyecto3.pdf)
b. Relationships and data flow:
c. Architectural patterns and principles:
- Pipeline pattern: clear separation of data, model code, and experimentation
- Modularity: utils.py handles data functions; pytorchtools.py handles training utilities
- Reproducibility: experiments encapsulated in versioned notebooks
d. Technologies, frameworks, libraries:
- Python, Jupyter notebooks
- PyTorch (CNN implementation)
- Supporting libs: torchvision, pandas/numpy, matplotlib/seaborn

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Project Overview
    README["README.md\n(Project Overview)"]:::code
    click README "https://github.com/allen-utec/cnn/blob/main/README.md"

    %% Data Source
    DS[("Kaggle Dataset")]:::data

    %% Processing Layer
    utils["Data Ingestion & Preprocessing\n(utils.py)"]:::code
    click utils "https://github.com/allen-utec/cnn/blob/main/utils.py"

    %% Model Layer
    pttools["Training Utilities & Callbacks\n(pytorchtools.py)"]:::code
    click pttools "https://github.com/allen-utec/cnn/blob/main/pytorchtools.py"

    modelDef["Model Definition & Training Loop\n(in Notebooks + pytorchtools)"]:::code

    %% Experiment Controller
    subgraph "Experiment Controller (Notebooks)" 
        direction TB
        intro["proyecto3_introduction.ipynb"]:::notebook
        e1["proyecto3_experimento_1.ipynb"]:::notebook
        e2["proyecto3_experimento_2.ipynb"]:::notebook
        e3["proyecto3_experimento_3.ipynb"]:::notebook
        e4["proyecto3_experimento_4.ipynb"]:::notebook
        e5["proyecto3_experimento_5.ipynb"]:::notebook
        e6["proyecto3_experimento_6.ipynb"]:::notebook
        e7["proyecto3_experimento_7.ipynb"]:::notebook
        e8["proyecto3_experimento_8.ipynb"]:::notebook
        e9["proyecto3_experimento_9.ipynb"]:::notebook
        e10["proyecto3_experimento_10.ipynb"]:::notebook
        e11["proyecto3_experimento_11.ipynb"]:::notebook
        e12["proyecto3_experimento_12.ipynb"]:::notebook
        e13["proyecto3_experimento_13.ipynb"]:::notebook
        e14["proyecto3_experimento_14.ipynb"]:::notebook
        e15["proyecto3_experimento_15.ipynb"]:::notebook
        e16["proyecto3_experimento_16.ipynb"]:::notebook
        e17["proyecto3_experimento_17.ipynb"]:::notebook
    end
    click intro "https://github.com/allen-utec/cnn/blob/main/proyecto3__introduction.ipynb"
    click e1 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_1.ipynb"
    click e2 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_2.ipynb"
    click e3 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_3.ipynb"
    click e4 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_4.ipynb"
    click e5 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_5.ipynb"
    click e6 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_6.ipynb"
    click e7 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_7.ipynb"
    click e8 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_8.ipynb"
    click e9 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_9.ipynb"
    click e10 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_10.ipynb"
    click e11 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_11.ipynb"
    click e12 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_12.ipynb"
    click e13 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_13.ipynb"
    click e14 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_14.ipynb"
    click e15 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_15.ipynb"
    click e16 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_16.ipynb"
    click e17 "https://github.com/allen-utec/cnn/blob/main/proyecto3_experimento_17.ipynb"

    %% Evaluation & Output
    eval["Evaluation & Visualization\n(in Notebooks)"]:::artifact
    artifacts["Output Artifacts\n(trained model, logs, figures, proyecto3.pdf)"]:::artifact
    click artifacts "https://github.com/allen-utec/cnn/blob/main/proyecto3.pdf"

    %% Data Flow
    README -->|"instructions"| utils
    utils -->|"raw data"| DS
    DS -->|"raw dataset"| utils
    utils -->|"preprocessed data"| modelDef
    pttools -->|"callbacks"| modelDef
    modelDef -->|"invoked by"| intro
    modelDef -->|"invoked by"| e1
    modelDef -->|"invoked by"| e2
    modelDef -->|"invoked by"| e3
    modelDef -->|"invoked by"| e4
    modelDef -->|"invoked by"| e5
    modelDef -->|"invoked by"| e6
    modelDef -->|"invoked by"| e7
    modelDef -->|"invoked by"| e8
    modelDef -->|"invoked by"| e9
    modelDef -->|"invoked by"| e10
    modelDef -->|"invoked by"| e11
    modelDef -->|"invoked by"| e12
    modelDef -->|"invoked by"| e13
    modelDef -->|"invoked by"| e14
    modelDef -->|"invoked by"| e15
    modelDef -->|"invoked by"| e16
    modelDef -->|"invoked by"| e17
    intro -->|"results"| eval
    e1 --> eval
    e2 --> eval
    e3 --> eval
    e4 --> eval
    e5 --> eval
    e6 --> eval
    e7 --> eval
    e8 --> eval
    e9 --> eval
    e10 --> eval
    e11 --> eval
    e12 --> eval
    e13 --> eval
    e14 --> eval
    e15 --> eval
    e16 --> eval
    e17 --> eval
    eval -->|"reports & files"| artifacts

    classDef code fill:#B3DDF2,stroke:#333,stroke-width:1px
    classDef data fill:#C2F0C2,stroke:#333,stroke-width:1px
    classDef artifact fill:#FFD699,stroke:#333,stroke-width:1px
    classDef notebook fill:#E0E0E0,stroke:#333,stroke-width:1px
```
