# peichunchang/ms-ssincresnet_with_iiof architecture

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

- Interactive diagram: https://gitdiagram.com/peichunchang/ms-ssincresnet_with_iiof
- Repository: https://github.com/peichunchang/ms-ssincresnet_with_iiof

## Overview

##### Project type and purpose
- This is a research‐oriented PyTorch project for Music Emotion Recognition (MER), specifically implementing an “MS-SSincResNet with IIOF” fusion model.
- It provides data loading, model definition, training loops (for DEAM and PMEmo datasets), utilities, and a test/evaluation script.

##### File structure
- Top level:
- README.md (project overview & usage)
- main_DEAM.py, main_PMEmo.py (entry scripts for two datasets)
- dataloader.py (dataset loader and preprocessing routines)
- models.py (definition of MS-SSincResNet and IIOF fusion layers)
- utils.py (helper functions: argument parsing, logging, checkpointing)
- test.py (evaluation pipeline)
- __pycache__ (compiled Python files)
- No separate “frontend/backend” but clear modular separation into Data → Model → Train/Evaluate.

##### README for additional insights
- Lists system requirements (Ubuntu, Python, PyTorch, dependencies).
- Shows dataset directory layout (annotation mats, numpy features, CV splits).
- Usage examples for training scripts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer
    subgraph "Data Layer"
        DatasetStore[(Dataset Store)]:::data
        DataLoader["DataLoader Module"]:::code
        Preprocess["Preprocessing Steps"]:::code
    end

    %% Model Definition
    subgraph "Model Definition"
        backbone["MS-SSincResNet Backbone"]:::model
        intrafusion["Intra-Feature Orthogonal Fusion"]:::model
        interfusion["Inter-Feature Orthogonal Fusion"]:::model
        head["Final Regression/Classification Head"]:::model
    end

    %% Training Layer
    subgraph "Training Pipeline"
        entryDEAM["main_DEAM.py"]:::entry
        entryPMEmo["main_PMEmo.py"]:::entry
        UtilsParse["Argument Parsing & Config Utilities"]:::util
        OptSched["Optimizer & LR Scheduler"]:::training
        Forward["Forward Pass"]:::training
        Loss["Loss Computation"]:::training
        Backprop["Backward Pass"]:::training
        Checkpoint["Checkpoint & Logging"]:::util
    end

    %% Evaluation Layer
    subgraph "Evaluation Module"
        Test["test.py"]:::eval
    end

    %% External Libraries
    PyTorch["PyTorch & torchvision"]:::external
    SciPy["scipy, numpy"]:::external

    %% Data Flow
    entryDEAM -->|"start training"| UtilsParse
    entryPMEmo -->|"start training"| UtilsParse
    UtilsParse --> DataLoader
    DataLoader --> Preprocess
    Preprocess --> backbone
    backbone --> intrafusion
    intrafusion --> interfusion
    interfusion --> head
    head --> Forward
    Forward --> Loss
    Loss --> Backprop
    Backprop --> OptSched
    OptSched --> head
    Backprop --> Checkpoint
    head --> Test
    DataLoader -->|uses CV splits| Test
    Test -->|"outputs metrics/plots"| metrics["Metrics & Plots"]

    %% External deps
    backbone --- PyTorch
    Preprocess --- SciPy
    DataLoader --- SciPy

    %% Click Events
    click DatasetStore "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/README.md"
    click DataLoader "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/dataloader.py"
    click Preprocess "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/dataloader.py"
    click backbone "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/models.py"
    click intrafusion "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/models.py"
    click interfusion "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/models.py"
    click head "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/models.py"
    click entryDEAM "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/main_DEAM.py"
    click entryPMEmo "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/main_PMEmo.py"
    click UtilsParse "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/utils.py"
    click Checkpoint "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/utils.py"
    click Test "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/test.py"
    click metrics "https://github.com/peichunchang/ms-ssincresnet_with_iiof/blob/main/README.md"

    %% Styles
    classDef data fill:#ABEBC6,stroke:#27AE60,color:#1D8348;
    classDef code fill:#D6EAF8,stroke:#3498DB,color:#21618C;
    classDef model fill:#FAD7A0,stroke:#D68910,color:#7D6608;
    classDef training fill:#F5CBA7,stroke:#CA6F1E,color:#784212;
    classDef util fill:#FCF3CF,stroke:#B7950B,color:#7D6608;
    classDef entry fill:#D2B4DE,stroke:#8E44AD,color:#512E5F;
    classDef eval fill:#F9E79F,stroke:#B7950B,color:#7D6608;
    classDef external fill:#E8DAEF,stroke:#7D3C98,color:#4A235A;
```
