# xinyu-yi/transpose architecture

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

- Interactive diagram: https://gitdiagram.com/xinyu-yi/transpose
- Repository: https://github.com/xinyu-yi/transpose

## Overview

##### Main System Components
- Data Input & Configuration: This includes the raw sensor and dataset inputs (e.g., DIP-IMU, TotalCapture, AMASS) and configuration settings (via config.py). These inputs are later preprocessed.
- Data Preprocessing: The preprocess.py script (and parts of live_demo.py) prepare data from various sources for inference. This module handles normalization and transformation of raw IMU/sensor data.
- Core Inference Engine:
- The “articulate” package is central here, containing modules like armature.py, evaluator.py, model.py, and a “math” submodule (with angular, general, and spatial helper functions). These modules are likely responsible for constructing the human skeleton, performing pose estimation, and applying mathematical transformations.
- The net.py file possibly defines the neural network architecture (implemented with PyTorch) that processes sensor inputs and outputs the predicted pose and translation.
- The system also integrates the SMPL body model whose path is set in config.py.
- Evaluation & Examples:
- evaluate.py runs evaluation routines on the processed data.
- example.py provides a complete run-through using provided IMU sequences.
- Live Demo and Visualization:
- live_demo.py contains the live streaming demo (with socket communication for real-time visualization).
- example_server.py serves as the server side for Unity3D integration.
- Visualization is achieved via Open3D (for 3D rendering) and a Unity3D scene, using a dedicated Unity package.
- Utility & Support Scripts: These include utils.py (general utilities), and other helper scripts.

- Have a “Preprocessing Module” block (preprocess.py) that receives raw data, applies necessary normalizations/transformations, and outputs processed datasets, feeding into the inference engine.
- The “Mathematical and Articulation Modules” (articulate/ directory: armature, evaluator, model, math submodules) that handle kinematics, skeletal structure, and sensor fusion.
- The “Neural Network Module” (net.py and the weights loaded via config.py) operating within the PyTorch environment.
- From the “Pose Estimation Engine”, show two paths:
- One leading to “Evaluation and Testing” (evaluate.py and example.py, demonstrating offline testing and simulation).
- Another leading towards “Real-time Visualization” which splits into two sub-blocks:
- Rendering output using Open3D (e.g., within example.py and live_demo.py).
- Streaming pose data to Unity3D for interactive visualization (using example_server.py and a custom client in Unity3D).

##### Architectural Patterns & Technologies
- The code separation into distinct scripts reflects a modular design — each component (preprocessing, inference, evaluation, and visualization) is independent yet interlinked.
- Notice the explicit dependency on PyTorch for the deep learning model, and the use of external libraries like chumpy, vctoolkit, and open3d.
- The system uses a configuration-driven pattern via config.py, which centralizes paths and other settings.
- For real-time operations, sockets are used to communicate between the Python backend and Unity3D.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    subgraph "Data Input & Configuration"
        A1("Sensor Datasets (data/)"):::input
        A2("Configuration (config.py)"):::input
    end

    %% Processing Layer
    subgraph "Preprocessing Module"
        B1("Data Preprocessing (preprocess.py)"):::processing
    end

    %% Pose Estimation Engine
    subgraph "Pose Estimation Engine"
        C1("Articulation & Math Modules (articulate/)"):::estimation
        C2("Neural Network Module (net.py)"):::estimation
    end

    %% Output: Evaluation & Testing
    subgraph "Evaluation & Testing"
        D1("Evaluation (evaluate.py)"):::evaluation
        D2("Example Run (example.py)"):::evaluation
    end

    %% Output: Real-time Visualization
    subgraph "Real-time Visualization"
        E1("3D Rendering (Open3D, live_demo.py)"):::visualization
        E2("Streaming to Unity3D (example_server.py)"):::visualization
    end

    %% Utility & Support
    F1("Utility Scripts (utils.py)"):::utility

    %% Data Flow Connections
    A1 -->|"raw data"| B1
    A2 -->|"configures"| B1
    A2 -->|"SMPL model & weights"| C2
    B1 -->|"processed data"| C1
    B1 -->|"processed data"| C2
    C1 -->|"pose data"| D1
    C1 -->|"pose data"| D2
    C2 -->|"pose data"| D1
    C2 -->|"pose data"| D2
    C1 -->|"pose output"| E1
    C2 -->|"pose output"| E1
    C1 -->|"socket data"| E2
    C2 -->|"socket data"| E2

    %% Utility support arrows (dotted lines)
    F1 -.-> A2
    F1 -.-> B1
    F1 -.-> C1
    F1 -.-> C2

    %% Click Events
    click A1 "https://github.com/xinyu-yi/transpose/tree/main/data/"
    click A2 "https://github.com/xinyu-yi/transpose/blob/main/config.py"
    click B1 "https://github.com/xinyu-yi/transpose/blob/main/preprocess.py"
    click C1 "https://github.com/xinyu-yi/transpose/tree/main/articulate/"
    click C2 "https://github.com/xinyu-yi/transpose/blob/main/net.py"
    click D1 "https://github.com/xinyu-yi/transpose/blob/main/evaluate.py"
    click D2 "https://github.com/xinyu-yi/transpose/blob/main/example.py"
    click E1 "https://github.com/xinyu-yi/transpose/blob/main/live_demo.py"
    click E2 "https://github.com/xinyu-yi/transpose/blob/main/example_server.py"
    click F1 "https://github.com/xinyu-yi/transpose/blob/main/utils.py"

    %% Styles
    classDef input fill:#AED6F1,stroke:#34495E,stroke-width:2px;
    classDef processing fill:#F9E79F,stroke:#F39C12,stroke-width:2px;
    classDef estimation fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef evaluation fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef visualization fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
    classDef utility fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
```
