# mrgi23/music-genres-classification architecture

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

- Interactive diagram: https://gitdiagram.com/mrgi23/music-genres-classification
- Repository: https://github.com/mrgi23/music-genres-classification

## Overview

Music Genres Classification is a dual-language audio classification system for GTZAN-style music data. Its main workflow prepares audio features and dataset splits, then trains or loads a CNN and predicts genres or evaluates performance. The Python and C++ implementations share these domain stages; the C++ executable and Python command-line wrapper provide separate orchestration paths. The README also describes automatic spectrogram/MFCC feature extraction and the ten-class task. Some implementation links rely on the SOURCE INDEX; unsampled relationships are omitted.

Main entry points: [`app/utils_py.py`](https://github.com/mrgi23/music-genres-classification/blob/main/app/utils_py.py) (Python workflow), [`src/cpp/trainer.cpp`](https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/trainer.cpp) (Train and evaluate), [`app/utils.hpp`](https://github.com/mrgi23/music-genres-classification/blob/main/app/utils.hpp) (C++ workflow), [`app/main.cpp`](https://github.com/mrgi23/music-genres-classification/blob/main/app/main.cpp) (C++ CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entrypoints"]
  node_cpp_cli["C++ CLI<br/>[main.cpp]"]
  node_cpp_flow["C++ workflow<br/>[utils.hpp]"]
  node_py_cli["Python CLI<br/>[musicnet_py.py]"]
  node_py_flow["Python workflow<br/>[utils_py.py]"]
end

subgraph group_python["Python runtime"]
  node_py_download["Dataset download<br/>[downloader.py]"]
  node_py_preprocess["Audio features<br/>[preprocessor.py]"]
  node_py_dataset["Audio dataset<br/>[dataset.py]"]
  node_py_model["CNN model<br/>[model.py]"]
end

subgraph group_cpp["C++ runtime"]
  node_cpp_download["Dataset download<br/>[downloader.cpp]"]
  node_cpp_preprocess["Audio features<br/>[preprocessor.cpp]"]
  node_cpp_dataset["Audio dataset<br/>[dataset.cpp]"]
  node_cpp_model["CNN model<br/>[model.cpp]"]
end

subgraph group_training["Training components"]
  node_py_trainer["Train and evaluate<br/>[trainer.py]"]
  node_cpp_optimizer["Optimizer factory<br/>[optimizer.hpp]"]
  node_cpp_scheduler["Learning scheduler<br/>[scheduler.cpp]"]
  node_cpp_trainer["Train and evaluate<br/>[trainer.cpp]"]
end

node_user(("Operator"))

node_user -->|"runs"| node_cpp_cli
node_cpp_cli -->|"dispatches"| node_cpp_flow
node_user -.->|"runs"| node_py_cli
node_py_cli -->|"delegates to"| node_py_flow
node_py_flow -->|"uses"| node_py_download
node_py_flow -->|"uses"| node_py_preprocess
node_py_flow -->|"uses"| node_py_dataset
node_py_flow -->|"uses"| node_py_model
node_py_flow -->|"uses"| node_py_trainer
node_py_dataset -->|"extracts features with"| node_py_preprocess
node_py_trainer -->|"trains and evaluates"| node_py_model
node_cpp_flow -->|"uses"| node_cpp_download
node_cpp_flow -->|"uses"| node_cpp_trainer
node_cpp_dataset -->|"extracts features with"| node_cpp_preprocess
node_cpp_trainer -->|"reads batches from"| node_cpp_dataset
node_cpp_trainer -->|"trains and evaluates"| node_cpp_model
node_cpp_trainer -.->|"creates optimizer"| node_cpp_optimizer
node_cpp_trainer -.->|"attaches scheduler"| node_cpp_scheduler

click node_cpp_cli "https://github.com/mrgi23/music-genres-classification/blob/main/app/main.cpp"
click node_cpp_flow "https://github.com/mrgi23/music-genres-classification/blob/main/app/utils.hpp"
click node_py_cli "https://github.com/mrgi23/music-genres-classification/blob/main/app/musicnet_py.py"
click node_py_flow "https://github.com/mrgi23/music-genres-classification/blob/main/app/utils_py.py"
click node_py_download "https://github.com/mrgi23/music-genres-classification/blob/main/src/python/downloader.py"
click node_py_preprocess "https://github.com/mrgi23/music-genres-classification/blob/main/src/python/preprocessor.py"
click node_py_dataset "https://github.com/mrgi23/music-genres-classification/blob/main/src/python/dataset.py"
click node_py_model "https://github.com/mrgi23/music-genres-classification/blob/main/src/python/model.py"
click node_py_trainer "https://github.com/mrgi23/music-genres-classification/blob/main/src/python/trainer.py"
click node_cpp_download "https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/downloader.cpp"
click node_cpp_preprocess "https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/preprocessor.cpp"
click node_cpp_dataset "https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/dataset.cpp"
click node_cpp_model "https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/model.cpp"
click node_cpp_optimizer "https://github.com/mrgi23/music-genres-classification/blob/main/inc/optimizer.hpp"
click node_cpp_scheduler "https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/scheduler.cpp"
click node_cpp_trainer "https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/trainer.cpp"

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_cpp_cli,node_cpp_flow,node_py_cli,node_py_flow toneBlue
class node_py_download,node_py_preprocess,node_py_dataset,node_py_model toneAmber
class node_cpp_download,node_cpp_preprocess,node_cpp_dataset,node_cpp_model toneMint
class node_py_trainer,node_cpp_optimizer,node_cpp_scheduler,node_cpp_trainer toneRose
class node_user toneIndigo
```

## Components

### Application entrypoints

- [C++ CLI](https://github.com/mrgi23/music-genres-classification/blob/main/app/main.cpp): `app/main.cpp`
- [C++ workflow](https://github.com/mrgi23/music-genres-classification/blob/main/app/utils.hpp): `app/utils.hpp`
- [Python CLI](https://github.com/mrgi23/music-genres-classification/blob/main/app/musicnet_py.py): `app/musicnet_py.py`
- [Python workflow](https://github.com/mrgi23/music-genres-classification/blob/main/app/utils_py.py): `app/utils_py.py`

### Python runtime

- [Dataset download](https://github.com/mrgi23/music-genres-classification/blob/main/src/python/downloader.py): `src/python/downloader.py`
- [Audio features](https://github.com/mrgi23/music-genres-classification/blob/main/src/python/preprocessor.py): `src/python/preprocessor.py`
- [Audio dataset](https://github.com/mrgi23/music-genres-classification/blob/main/src/python/dataset.py): `src/python/dataset.py`
- [CNN model](https://github.com/mrgi23/music-genres-classification/blob/main/src/python/model.py): `src/python/model.py`

### C++ runtime

- [Dataset download](https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/downloader.cpp): `src/cpp/downloader.cpp`
- [Audio features](https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/preprocessor.cpp): `src/cpp/preprocessor.cpp`
- [Audio dataset](https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/dataset.cpp): `src/cpp/dataset.cpp`
- [CNN model](https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/model.cpp): `src/cpp/model.cpp`

### Training components

- [Train and evaluate](https://github.com/mrgi23/music-genres-classification/blob/main/src/python/trainer.py): `src/python/trainer.py`
- [Optimizer factory](https://github.com/mrgi23/music-genres-classification/blob/main/inc/optimizer.hpp): `inc/optimizer.hpp`
- [Learning scheduler](https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/scheduler.cpp): `src/cpp/scheduler.cpp`
- [Train and evaluate](https://github.com/mrgi23/music-genres-classification/blob/main/src/cpp/trainer.cpp): `src/cpp/trainer.cpp`

### Other components

- **Operator**

## Connections

- Operator → C++ CLI: runs (evidence: `app/main.cpp`)
- C++ CLI → C++ workflow: dispatches (evidence: `app/main.cpp`)
- Operator → Python CLI: runs (evidence: `app/musicnet_py.py`)
- Python CLI → Python workflow: delegates to (evidence: `app/musicnet_py.py`)
- Python workflow → Dataset download: uses (evidence: `app/utils_py.py`)
- Python workflow → Audio features: uses (evidence: `app/utils_py.py`)
- Python workflow → Audio dataset: uses (evidence: `app/utils_py.py`)
- Python workflow → CNN model: uses (evidence: `app/utils_py.py`)
- Python workflow → Train and evaluate: uses (evidence: `app/utils_py.py`)
- Audio dataset → Audio features: extracts features with (evidence: `src/python/dataset.py`)
- Train and evaluate → CNN model: trains and evaluates (evidence: `src/python/trainer.py`)
- C++ workflow → Dataset download: uses (evidence: `app/utils.hpp`)
- C++ workflow → Train and evaluate: uses (evidence: `app/utils.hpp`)
- Audio dataset → Audio features: extracts features with
- Train and evaluate → Audio dataset: reads batches from
- Train and evaluate → CNN model: trains and evaluates
- Train and evaluate → Optimizer factory: creates optimizer
- Train and evaluate → Learning scheduler: attaches scheduler
