# fanghuachen/aednet architecture

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

- Interactive diagram: https://gitdiagram.com/fanghuachen/aednet
- Repository: https://github.com/fanghuachen/aednet

## Overview

##### Project type and purpose
- This is a research‐oriented deep‐learning pipeline (“AEDNet”) for asynchronous event denoising. It consumes irregular spatiotemporal event data, trains a neural network to remove noise, and evaluates denoising performance.

##### File structure
- Top‐level directories and files:
- BA_noise_removal/ — core Python modules
– aednet.py (model definition)
– dataprocess.py (data loader & preprocessor)
– train_net.py (training script)
– test_net.py (inference script)
– results/ (directory for outputs: plots, logs)
– __pycache__/
- data/ — raw and split datasets
– AEDNetDataset_BA/ (training data + file lists)
– AEDNetTestset_BA/ (test data)
- models/ — saved model artifacts
– BA_noise_removal_model/
· AEDNet_params.pth (trained weights)
· AEDNet_description.txt
- pic/ — example visualizations
- README.md

##### README for additional insights
- Purpose: implement and evaluate the AEDNet denoising network.
- Key components:
- Data organization and naming conventions
- Training command‑line interface (CLI)
- Testing CLI
- Dependencies: Python 3.7, PyTorch, NumPy, Matplotlib, tensorboardX

a. Main components:
1. Data Layer
- Raw event files under data/AEDNetDataset_BA & data/AEDNetTestset_BA
- File lists (training_file_name.txt, test_file_name.txt)
2. Data Processing Module
- dataprocess.py: loads .npy files, constructs batches, applies any normalization
3. Model Definition
- aednet.py: PyTorch neural network graph implementing spatial‑temporal correlation layers
4. Training Engine
- train_net.py:
· Reads CLI args (train/test file lists, hyperparameters)
· Invokes dataprocess → model → loss functions → optimizer
· Logs metrics, checkpoints to models/BA_noise_removal_model & results/
5. Inference Engine
- test_net.py:
· Loads saved weights from models/BA_noise_removal_model/AEDNet_params.pth
· Processes test data via dataprocess + aednet → outputs denoised event streams → saves to results/
6. Outputs & Visualization
- results/ folder: performance logs, plots
- pic/ folder: example GIFs demonstrating denoising quality
7. External Dependencies & Environment
- PyTorch, CUDA, NumPy, Matplotlib, tensorboardX

b. Relationships and interactions
- Data Layer feeds into Data Processing Module
- Data Processing Module pipelines batches into Model Definition
- Training Engine orchestrates the forward/backward passes and writes checkpoints
- Inference Engine reads checkpoints, drives the same data‑processing → model → output flow
- Results are visualized and compared against ground truth

c. Architectural patterns and design principles
- Modular separation: data I/O, preprocessing, model, training loop, testing loop
- Clear CLI interfaces for training vs. testing
- Checkpointing for reproducibility
- Use of standard deep‑learning framework patterns (dataset → dataloader → model → optimizer)

d. Key technologies / frameworks
- Python 3.7
- PyTorch (+ CUDA)
- NumPy
- Matplotlib & tensorboardX for logging and visualization

##### Final checklist
- Clear, descriptive labels on every component
- Legends or annotations for file‐locations and key parameters
- Emphasis on capturing all five modules (data, preprocess, model, train, test) without over‑splitting

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Data Layer"
        DataRaw["Raw Event Data\n(data/AEDNetDataset_BA/ &\ndata/AEDNetTestset_BA/)"]:::data
    end

    subgraph "Data Processing Module"
        Preprocess["dataprocess.py"]:::processing
    end

    subgraph "Model Definition"
        ModelDef["aednet.py"]:::model
    end

    subgraph "Training Engine (CLI)"
        Train["train_net.py\n(CLI args, hyperparameters)"]:::training
    end

    subgraph "Model Artifacts"
        Params["AEDNet_params.pth"]:::artifact
        Desc["AEDNet_description.txt"]:::artifact
    end

    subgraph "Inference Engine (CLI)"
        Test["test_net.py\n(CLI flags)"]:::inference
    end

    subgraph "Results & Visualization"
        Results["results/"]:::results
        Pic["pic/"]:::results
    end

    subgraph "External Dependencies & Overview"
        Dependencies["README.md & Env"]:::external
    end

    DataRaw -->|".npy files, file lists"| Preprocess
    Preprocess -->|".npy batches"| ModelDef
    ModelDef -->|"network graph"| Train
    Train -->|"checkpoints"| Params
    Train -->|"metadata"| Desc
    Train -->|"logs, plots"| Results
    Params -->|"weights"| Test
    DataRaw -->|"test .npy"| Test
    Test -->|"denoised streams"| Results
    Results -->|"example GIFs"| Pic

    click DataRaw "https://github.com/fanghuachen/aednet/tree/main/data/AEDNetDataset_BA/"
    click Preprocess "https://github.com/fanghuachen/aednet/blob/main/BA_noise_removal/dataprocess.py"
    click ModelDef "https://github.com/fanghuachen/aednet/blob/main/BA_noise_removal/aednet.py"
    click Train "https://github.com/fanghuachen/aednet/blob/main/BA_noise_removal/train_net.py"
    click Test "https://github.com/fanghuachen/aednet/blob/main/BA_noise_removal/test_net.py"
    click Params "https://github.com/fanghuachen/aednet/blob/main/models/BA_noise_removal_model/AEDNet_params.pth"
    click Desc "https://github.com/fanghuachen/aednet/blob/main/models/BA_noise_removal_model/AEDNet_description.txt"
    click Results "https://github.com/fanghuachen/aednet/tree/main/BA_noise_removal/results/"
    click Pic "https://github.com/fanghuachen/aednet/tree/main/pic/"
    click Dependencies "https://github.com/fanghuachen/aednet/blob/main/README.md"

    classDef data fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef processing fill:#90EE90,stroke:#000,stroke-width:1px
    classDef model fill:#FFA500,stroke:#000,stroke-width:1px
    classDef training fill:#9370DB,stroke:#000,stroke-width:1px
    classDef inference fill:#20B2AA,stroke:#000,stroke-width:1px
    classDef results fill:#FFD700,stroke:#000,stroke-width:1px
    classDef artifact fill:#DDA0DD,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
```
