# heuzef/champi_cnn architecture

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

- Interactive diagram: https://gitdiagram.com/heuzef/champi_cnn
- Repository: https://github.com/heuzef/champi_cnn

## Overview

##### Main Components
- Data Ingestion and Preprocessing:
– The “dataset” folder holds the canonical data sets, and src/data contains scripts for data generation and preprocessing (both Linux and Windows variants). Some notebooks also demonstrate data augmentation and pre-processing (e.g., cropping, resizing, normalization with VGG16 parameters).
- Feature Extraction and Augmentation:
- Model Training and Evaluation:
– Model training implementations are found in both src/models (with subfolders for resnet and vgg16) and in notebooks dedicated to transfer learning. Training metrics are logged and stored, and there is evidence of experiments with Grad-CAM and different model versions.
- Experiment Tracking and System Utilities:
– The src/sys folder holds shell and service scripts (e.g., for setting up an MLflow server) that indicate integration with MLflow for experiment tracking.
- Exploratory Notebooks and Reporting:
– Extensive notebooks in the “notebooks” folder are used for exploratory analysis, prototyping, and model validation. The “reports” folder contains final reports, including a Streamlit dashboard (with clear page separation) and additional visual reports.
- External Interfaces:
– There is also a “localhost” component (found under notebooks/mushroom_observer and its subdirectories) that might serve as a small-scale web interface for dataset browsing or demonstration purposes.

##### Architectural Patterns and Relevant Technologies
- Layer Separation:
– Clearly demarcate the data, model, and reporting layers. Notebooks support the experimental process, while the src folder holds production code.
- Experiment Tracking:
– Emphasize MLflow’s role in logging training runs, as evident from various MLflow-related scripts.
- Use of Notebooks for Prototyping:
– Show that Jupyter notebooks are a major medium for exploratory analysis and may eventually lead into production through scripts in src.
- Technologies:
– Include Python (and Jupyter), deep learning frameworks (likely PyTorch or TensorFlow, given the file names and known architectures), shell scripts for MLflow deployment, and Streamlit for dashboards.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer
    subgraph "Data Layer"
        N1["Dataset Repository"]:::data
        N2["Data Scripts (src/data)"]:::data
    end

    %% Feature Extraction Layer
    subgraph "Feature Extraction Layer"
        N3["Feature Extraction Modules (src/features)"]:::feature
    end

    %% Modeling Layer
    subgraph "Modeling Layer"
        N4["Model Training Code (src/models)"]:::modeling
        N5["Transfer Learning Notebook: ResNet50 (notebooks/transfer_learning_ResNet50)"]:::modeling
        N6["Transfer Learning Notebook: EfficientNetB1 (notebooks/transfer_learning_efficientnetb1)"]:::modeling
        N7["Exploratory Notebooks (notebooks)"]:::modeling
    end

    %% Experiment Tracking Layer
    subgraph "Experiment Tracking"
        N8["MLflow & System Scripts (src/sys)"]:::tracking
    end

    %% Reporting Layer
    subgraph "Reporting Layer"
        N9["Reporting & Dashboard (reports)"]:::reporting
    end

    %% External Interface Layer
    subgraph "Deployment / Integration"
        N10["Localhost Web Interface (notebooks/mushroom_observer)"]:::external
    end

    %% Connections
    %% Data ingestion to Feature Extraction
    N1 -->|"raw-data"| N3
    N2 -->|"ingestion scripts"| N3

    %% Feature Extraction to Modeling Layer
    N3 -->|"feature extraction"| N4
    N3 -->|"exploratory analysis"| N7

    %% Internal Modeling Flow (branching transfer learning experiments)
    N4 -->|"transfer learning"| N5
    N4 -->|"transfer learning"| N6

    %% Modeling outputs logged to Experiment Tracking
    N4 -->|"log metrics"| N8
    N5 -->|"log metrics"| N8
    N6 -->|"log metrics"| N8
    N7 -->|"log experiments"| N8

    %% Experiment Tracking to Reporting
    N8 -->|"tracked results"| N9

    %% Reporting feeds External Interface
    N9 -->|"dashboard view"| N10

    %% Styles
    classDef data fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef feature fill:#A9DFBF,stroke:#186A3B,stroke-width:2px;
    classDef modeling fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef tracking fill:#E6B0AA,stroke:#922B21,stroke-width:2px;
    classDef reporting fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef external fill:#FAD7A0,stroke:#D35400,stroke-width:2px;

    %% Click Events
    click N1 "https://github.com/heuzef/champi_cnn/tree/main/dataset/"
    click N2 "https://github.com/heuzef/champi_cnn/tree/main/src/data/"
    click N3 "https://github.com/heuzef/champi_cnn/tree/main/src/features/"
    click N4 "https://github.com/heuzef/champi_cnn/tree/main/src/models/"
    click N5 "https://github.com/heuzef/champi_cnn/tree/main/notebooks/transfer_learning_ResNet50/"
    click N6 "https://github.com/heuzef/champi_cnn/tree/main/notebooks/transfer_learning_efficientnetb1/"
    click N7 "https://github.com/heuzef/champi_cnn/tree/main/notebooks/"
    click N8 "https://github.com/heuzef/champi_cnn/tree/main/src/sys/"
    click N9 "https://github.com/heuzef/champi_cnn/tree/main/reports/"
    click N10 "https://github.com/heuzef/champi_cnn/tree/main/notebooks/mushroom_observer/"
```
