https://github.com/armanasq/te-pinn-transformer-enhanced-physics-informed-neural-network-quaternion-orientation-estimation
A Transformer-Enhanced Physics-Informed Neural Network for accurate orientation estimation using IMU data. This repository integrates transformer networks with rigid body dynamics, multi-head attention, and RK4-based quaternion integration, optimized for embedded systems. TE-PINN reduces mean error by 36.8% and computational complexity by 25%.
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.7%) to scientific vocabulary
Repository
A Transformer-Enhanced Physics-Informed Neural Network for accurate orientation estimation using IMU data. This repository integrates transformer networks with rigid body dynamics, multi-head attention, and RK4-based quaternion integration, optimized for embedded systems. TE-PINN reduces mean error by 36.8% and computational complexity by 25%.
Basic Info
- Host: GitHub
- Owner: Armanasq
- Default Branch: main
- Size: 14.6 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
TE-PINN: Quaternion-Based Orientation Estimation
Table of Contents
Performance Overview
| Metric | TE-PINN | SOTA | Improvement | |--------|---------|------|-------------| | Mean Euler Error | 0.0195 | 0.0216 | -36.84% | | Dynamic Error | 0.1677 | 0.1242 | -35.04% | | Uncertainty Correlation | 0.0147 | 0.0553 | +73.44% | | Computational Time | 25ms | 33ms | -25.00% | | Memory Usage | 45MB | 62MB | -27.42% |
Overview
TE-PINN represents a significant advancement in orientation estimation by combining transformer architectures with physics-informed neural networks. Our approach uniquely integrates:
Core Components
- Quaternion-based transformer encoder for temporal modeling
- Physics-informed neural network for dynamic constraints
- Adaptive multi-objective loss function
- RK4-based quaternion integration
- Uncertainty quantification through evidential learning
Technical Innovation
- First implementation of transformer architecture for IMU-based orientation estimation
- Novel integration of physical constraints in attention mechanism
- Real-time capable implementation for embedded systems
Architecture
System Overview
```mermaid graph TD A[IMU Data Input] --> B[Quaternion Transformer] B --> C[Multi-Head Attention] A --> D[Physics Layer] D --> E[RK4 Integration] C --> F[Fusion Layer] E --> F F --> G[Attitude Correction] G --> H[Final Quaternion Output]
subgraph Physics Constraints
D
E
end
subgraph Transformer Processing
B
C
end
subgraph Output Processing
F
G
H
end
```
Data Flow
```mermaid sequenceDiagram participant IMU as IMU Sensors participant TE as Transformer Encoder participant PL as Physics Layer participant AC as Attitude Correction participant OUT as Output
IMU->>TE: (t), a(t)
Note over TE: Multi-head Attention
TE->>PL: Initial Estimates
Note over PL: RK4 Integration<br/>Rigid Body Dynamics
PL->>AC: Physics-Constrained Output
Note over AC: Yaw Correction
AC->>OUT: Final Quaternion
```
Mathematical Foundations
1. Input Processing
python
x(t) = [(t), a(t)] # IMU measurements
2. Positional Encoding
python
P(i,2k) = sin(t/10000^(2k/dmodel))
P(i,2k+1) = cos(t/10000^(2k/dmodel))
3. Transformer Layer
python
H = Linear(x) + P
Z = LayerNorm(H + MultiHeadAttention(H))
H = LayerNorm(Z + FeedForward(Z))
4. Physics Integration
```python
Rigid Body Dynamics
I d/dt + (I) =
Quaternion Integration
qw = cos(/2)cos(/2) qx = sin(/2)cos(/2) qy = cos(/2)sin(/2) qz = sin(/2)sin(/2) ```
Installation
Prerequisites
- Python 3.8+
- PyTorch 2.0+
- CUDA 11.0+ (for GPU support)
```bash
Clone repository
git clone https://github.com/yourusername/tepinn cd tepinn
Install dependencies
pip install -r requirements.txt
Optional: Install development dependencies
pip install -r requirements-dev.txt ```
Usage
Basic Usage
```python import tepinn
Initialize model
model = tepinn.TEPINN( transformerlayers=6, heads=8, dmodel=256 )
Train model
model.train(imudata, quaterniongt)
Inference
qpred = model.predict(imusequence) ```
Advanced Configuration
```python
Custom physics constraints
model.setphysicsparameters( inertiatensor=custominertia, gravityvector=customgravity )
Uncertainty estimation
qpred, uncertainty = model.predictwithuncertainty(imusequence) ```
Experimental Results
Performance Analysis
1. Error Metrics
| Scenario | Mean Error (deg) | STD | Max Error | |----------|------------------|-----|-----------| | Static | 0.195 | 0.023 | 0.412 | | Dynamic | 0.677 | 0.089 | 1.234 | | High Speed | 1.242 | 0.156 | 2.567 |
2. Ablation Study Results
| Component | Mean Error | Dynamic Error | Compute Time | |-----------|------------|---------------|--------------| | Base Model | 0.0216 | 0.1242 | 33ms | | + Transformer | 0.0205 | 0.1198 | 30ms | | + Physics | 0.0195 | 0.1677 | 25ms | | + Uncertainty | 0.0195 | 0.1677 | 25ms |
Hyper-parameters
| Parameter | Value | Description | |-----------|-------|-------------| | Transformer Layers | 6 | Number of transformer encoder layers | | Attention Heads | 8 | Number of parallel attention heads | | Model Dimension | 256 | Internal representation dimension | | Learning Rate | 1e-4 | Initial learning rate | | Batch Size | 32 | Training batch size | | acc | 1.0 | Accelerometer loss weight | | gyro | 0.5 | Gyroscope loss weight | | dynamics | 0.1 | Dynamics loss weight |
Model Capabilities
1. Real-time Performance
- 25ms average inference time on embedded systems
- 45MB memory footprint
- Support for batch processing
2. Robustness Features
- Handles sensor noise up to 0.1 rad/s for gyroscope
- Manages accelerometer noise up to 0.2 m/s
- Adaptive to varying sampling rates (100-500 Hz)
3. Uncertainty Quantification
- Provides calibrated uncertainty estimates
- Supports multiple uncertainty metrics
- Real-time confidence bounds
Citation
bibtex
@article{asgharpoor2024tepinn,
title={TE-PINN: Quaternion-Based Orientation Estimation using Transformer-Enhanced Physics-Informed Neural Networks},
author={Asgharpoor Golroudbari, Arman},
journal={arXiv preprint arXiv:2409.16214},
year={2024}
}
Future Work
Extended Functionality
- Multi-sensor fusion support
- Adaptive learning rates
- Online calibration
Performance Optimization
- Model quantization
- Sparse attention mechanisms
- Hardware-specific optimizations
Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Process
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Students' Scientific Research Center for research support
- Open-source community for various tools and libraries
- All contributors and testers
Owner
- Name: Arman Asgharpoor
- Login: Armanasq
- Kind: user
- Company: University of Tehran
- Website: https://armanasq.github.io/
- Twitter: Armannearu
- Repositories: 1
- Profile: https://github.com/Armanasq
Avionics Engineer M.Sc. Space Engineering AI / Deep Learning
GitHub Events
Total
- Issues event: 1
- Watch event: 6
- Push event: 4
- Fork event: 1
- Create event: 2
Last Year
- Issues event: 1
- Watch event: 6
- Push event: 4
- Fork event: 1
- Create event: 2