# liguge/dlwcb architecture

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

- Interactive diagram: https://gitdiagram.com/liguge/dlwcb
- Repository: https://github.com/liguge/dlwcb

## Overview

DLWCB is a PyTorch rolling-bearing fault-diagnosis model. Its principal workflow loads labeled MATLAB signals, standardizes and splits them into batches, trains and evaluates a dual-branch Laplace-wavelet CNN/BiGRU classifier, and saves model weights. The repository also includes a separate model-definition file and validation-loss-based early stopping. Evidence is limited to the README and sampled Python files; the documented broader evaluation claims are not independently established by the code shown.

Main entry points: [`proposed_model.py`](https://github.com/liguge/dlwcb/blob/main/proposed_model.py) (Train and evaluate), [`gdatasave.py`](https://github.com/liguge/dlwcb/blob/main/gdatasave.py) (Load and split data), [`early_stopping.py`](https://github.com/liguge/dlwcb/blob/main/early_stopping.py) (Early stopping), [`laplacewave.py`](https://github.com/liguge/dlwcb/blob/main/laplacewave.py) (Laplace convolution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Signal data"]
  node_data_pipeline["Load and split data<br/>[gdatasave.py]"]
  node_train_batches["Training batches<br/>[gdatasave.py]"]
  node_test_batches["Test batches<br/>[gdatasave.py]"]
end

subgraph group_model["Diagnosis model"]
  node_classifier["DLWCB classifier<br/>[proposed_model.py]"]
  node_reference_model["Net definition<br/>[DLWCB.py]"]
  node_laplace["Laplace convolution<br/>[laplacewave.py]"]
end

subgraph group_runtime["Training runtime"]
  node_trained_net["Train and evaluate<br/>[proposed_model.py]"]
  node_early_stop["Early stopping<br/>[early_stopping.py]"]
end

subgraph group_artifacts["Model artifacts"]
  node_weights["Model weights"]
end

node_researcher(("Researcher"))
node_bearing_data["Bearing MAT data"]

node_researcher -->|"provides signals"| node_bearing_data
node_bearing_data -->|"loads MAT files"| node_data_pipeline
node_data_pipeline -->|"builds batches"| node_train_batches
node_data_pipeline -->|"builds batches"| node_test_batches
node_train_batches -->|"trains on"| node_trained_net
node_test_batches -->|"evaluates on"| node_trained_net
node_trained_net -->|"runs forward"| node_classifier
node_classifier -->|"uses filters"| node_laplace
node_reference_model -->|"uses filters"| node_laplace
node_trained_net -->|"checks loss"| node_early_stop
node_early_stop -->|"saves checkpoint"| node_weights
node_trained_net -->|"saves weights"| node_weights

click node_data_pipeline "https://github.com/liguge/dlwcb/blob/main/gdatasave.py"
click node_train_batches "https://github.com/liguge/dlwcb/blob/main/gdatasave.py"
click node_test_batches "https://github.com/liguge/dlwcb/blob/main/gdatasave.py"
click node_trained_net "https://github.com/liguge/dlwcb/blob/main/proposed_model.py"
click node_classifier "https://github.com/liguge/dlwcb/blob/main/proposed_model.py"
click node_reference_model "https://github.com/liguge/dlwcb/blob/main/DLWCB.py"
click node_laplace "https://github.com/liguge/dlwcb/blob/main/laplacewave.py"
click node_early_stop "https://github.com/liguge/dlwcb/blob/main/early_stopping.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_data_pipeline,node_train_batches,node_test_batches toneBlue
class node_classifier,node_reference_model,node_laplace toneAmber
class node_trained_net,node_early_stop toneMint
class node_weights toneRose
class node_researcher,node_bearing_data toneIndigo
```

## Components

### Signal data

- [Load and split data](https://github.com/liguge/dlwcb/blob/main/gdatasave.py): `gdatasave.py`
- [Training batches](https://github.com/liguge/dlwcb/blob/main/gdatasave.py): `gdatasave.py`
- [Test batches](https://github.com/liguge/dlwcb/blob/main/gdatasave.py): `gdatasave.py`

### Diagnosis model

- [DLWCB classifier](https://github.com/liguge/dlwcb/blob/main/proposed_model.py): `proposed_model.py`
- [Net definition](https://github.com/liguge/dlwcb/blob/main/DLWCB.py): `DLWCB.py`
- [Laplace convolution](https://github.com/liguge/dlwcb/blob/main/laplacewave.py): `laplacewave.py`

### Training runtime

- [Train and evaluate](https://github.com/liguge/dlwcb/blob/main/proposed_model.py): `proposed_model.py`
- [Early stopping](https://github.com/liguge/dlwcb/blob/main/early_stopping.py): `early_stopping.py`

### Model artifacts

- **Model weights**

### Other components

- **Researcher**
- **Bearing MAT data**

## Connections

- Researcher → Bearing MAT data: provides signals (evidence: `README.md`)
- Bearing MAT data → Load and split data: loads MAT files (evidence: `gdatasave.py`)
- Load and split data → Training batches: builds batches (evidence: `gdatasave.py`)
- Load and split data → Test batches: builds batches (evidence: `gdatasave.py`)
- Training batches → Train and evaluate: trains on (evidence: `proposed_model.py`)
- Test batches → Train and evaluate: evaluates on (evidence: `proposed_model.py`)
- Train and evaluate → DLWCB classifier: runs forward (evidence: `proposed_model.py`)
- DLWCB classifier → Laplace convolution: uses filters (evidence: `proposed_model.py`)
- Net definition → Laplace convolution: uses filters (evidence: `DLWCB.py`)
- Train and evaluate → Early stopping: checks loss (evidence: `proposed_model.py`)
- Early stopping → Model weights: saves checkpoint (evidence: `early_stopping.py`)
- Train and evaluate → Model weights: saves weights (evidence: `proposed_model.py`)
