An end-to-end AI-Powered Digital Twin & Visual Inspection Platform for vehicle structural ladder-frame chassis assemblies. The system combines high-throughput GPU synthetic data generation in Blender Cycles, physics-informed domain randomization, deep convolutional autoencoders for microscopic defect detection, and an interactive React + Three.js 3D WebGL Digital Twin Dashboard.
The trained PyTorch Convolutional Autoencoder reconstructs baseline nominal joints and flags physical anomalies via high-intensity residual error heatmaps ($|I - \hat{I}|$):

High-density 3D spatial voxel clustering isolates structural load-bearing junctions from 361,174 CAD vertices (28000.obj):
| Top-Down Orthographic Chassis Overview | 3D Isometric CAD Perspective |
|---|---|
![]() |
![]() |
| Macro Top-Down Joint Crop (1:1 Sensor Framing) | High-Resolution Macro Perspective Detail |
|---|---|
![]() |
![]() |
Mathematical defect generator spawning irregular, distorted oxidic slag geometry directly onto the suspension weld seam for out-of-distribution anomaly validation:

flowchart TD
subgraph CADLayer ["1. CAD Ingestion & Clustering"]
CAD["Vehicle Chassis (28000.obj - 361k Vertices)"]
CLUSTER["3D Spatial Voxel Clustering"]
CAD --> CLUSTER
end
subgraph SyntheticGen ["2. Blender OptiX Synthetic Engine (GPU)"]
PBR["PBR Steel Shaders (Met: 0.85, Rough: 0.28)"]
RANDOM["Domain Randomization (Light Angle, Sun Energy, Jitter)"]
ANOMALY["Mathematical Slag / Weld Spatter Injector"]
CLUSTER --> RANDOM
PBR --> RANDOM
RANDOM --> |~0.60s / frame| BASELINE["4,850+ Normal Renders (weld_normal_*.png)"]
ANOMALY --> DEFECT_IMG["Defect Validation Frame (defective_test.png)"]
end
subgraph NeuralAI ["3. PyTorch Deep Autoencoder"]
ENC["Conv2d Encoder (256x256 -> 16x16)"]
DEC["ConvTranspose2d Decoder (16x16 -> 256x256)"]
LOSS["MSE Reconstruction Loss (|Input - Recon|)"]
BASELINE --> ENC --> DEC --> LOSS
end
subgraph BackendAPI ["4. FastAPI Gateway Service (:8000)"]
API_JOINTS["GET /api/joints (Hotspots Database)"]
API_INSPECT["POST /api/inspect (Live PyTorch Inference)"]
STATIC["Static Asset Server (/static/cad, /static/assets)"]
LOSS --> API_INSPECT
end
subgraph WebDashboard ["5. React + Three.js 3D Digital Twin (:5173)"]
CANVAS["Three.js 3D Viewport (OrbitControls + CAD Gizmo)"]
HOTSPOTS["Interactive Glowing 3D Hotspot Pins"]
SIDEBAR["Live Telemetry, Anomaly Gauges & Residual Heatmaps"]
RAYCAST["Click-to-Find CAD Coordinate Raycaster"]
STATIC --> CANVAS
API_JOINTS --> HOTSPOTS
API_INSPECT --> SIDEBAR
end
1024x1024 frames in ~0.60s – 0.80s (~80x speedup over CPU).3.0 to 8.5 energy).| Generates pixel-accurate reconstruction difference heatmaps ($ | \text{Input} - \text{Reconstruction} | $) to pinpoint localized structural defects. |
| Preset Key | Structural Joint Name | 3D CAD Coordinates $(X, Y, Z)$ | Local Vertices | Structural Details |
|---|---|---|---|---|
rear_sus_bracket (Defect Target) |
Rear Suspension Spring Perch | [1.358, 0.220, 0.500] |
18,395 | Rear spring perch tower and damper hardpoints (Slag defect test target). |
front_sus_bracket_left |
Front-Left Suspension Joint | [-1.227, 0.140, 0.398] |
29,947 | A-arm suspension mount, cross-tube weld interface, and frame rail flange. |
front_sus_bracket_right |
Front-Right Suspension Joint | [-1.185, 0.140, -0.416] |
26,822 | Symmetrical right A-arm bracket and gusset stiffener. |
engine_mount_crossmember |
Engine Mount Crossmember | [-0.644, 0.100, -0.452] |
21,557 | Heavy-duty chassis mounting bracket with reinforcement gussets. |
AutoTwin-AI/
├── .gitignore # Ignores large raw renders & CAD binaries
├── README.md # Complete project documentation & visual gallery
├── requirements.txt # Python dependencies (PyTorch, FastAPI, Uvicorn, Trimesh)
│
├── backend/ # FastAPI Backend Service
│ └── main.py # API Gateway, CAD asset server & live PyTorch inference
│
├── frontend/ # React + Three.js 3D Web Application
│ ├── package.json # Node dependencies (@react-three/fiber, three, tailwindcss)
│ ├── vite.config.js # Vite dev server configuration
│ ├── tailwind.config.js # Cyber-industrial theme & palette
│ ├── postcss.config.js
│ ├── index.html # HTML entrypoint
│ └── src/
│ ├── App.jsx # Main dashboard, telemetry sidebar & heatmap modal
│ ├── DigitalTwinViewer.jsx # Three.js 3D Canvas, CAD Gizmo & Hotspot Raycaster
│ ├── index.css # Custom cyberpunk glow styles & scanline animations
│ └── main.jsx # React DOM entrypoint
│
├── src/ # Core pipeline modules & algorithms
│ ├── __init__.py
│ ├── data_gen.py # Multi-joint synthetic dataset generator
│ ├── generate_autoencoder_dataset.py # 5,000-sample domain-randomized baseline generator
│ ├── data_gen_anomalous.py # Synthetic structural defect & weld slag injector
│ ├── train_autoencoder_pytorch.py # PyTorch Autoencoder training & heatmap visualizer
│ ├── data.py # Dataset verification & corrupted file cleaner
│ ├── generate_synthetic_data.py # Multi-view reference renderer
│ └── debug_blender.py # Blender environment diagnostics
│
├── docs/ # Documentation assets & showcase images
│ └── assets/
│ ├── 01_full_top_view_true_joint.png
│ ├── 02_full_isometric_true_joint.png
│ ├── 03_zoomed_true_joint_top_crop.png
│ ├── 04_zoomed_true_joint_isometric_detail.png
│ ├── defective_test.png
│ └── reconstruction_analysis.png
│
├── cad_model/ # Raw CAD assets (361k vertex chassis)
│ └── 28000.obj
│
├── joint_inspection/ # Structural joint inspection metadata
│ └── joint_info.json # 3D spatial coordinates & cluster properties
│
├── models/ # Trained neural network artifacts
│ ├── autoencoder_best.pth # Best model checkpoint (PyTorch weights - 9.38 MB)
│ └── reconstruction_analysis.png
│
└── synthetic_dataset/
├── autoencoder_baseline/ # 4,855 domain-randomized normal baseline frames
│ └── manifest.json # Ground-truth camera/lighting metadata
└── defective_test.png # Injected anomaly validation frame
# Clone the repository
git clone https://github.com/Arkz-Deepak/AutoTwin-AI.git
cd AutoTwin-AI
# Install Python dependencies (PyTorch with CUDA support)
pip install -r requirements.txt
# Install Frontend dependencies
cd frontend
npm install
cd ..
cd backend
python -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload
(Interactive Swagger API docs available at http://localhost:8000/docs)
cd frontend
npm run dev
(Open http://localhost:5173 in your browser)
# Windows
$env:NUM_IMAGES="5000"
& "C:\Program Files\Blender Foundation\Blender 5.1\blender.exe" -b --python src/generate_autoencoder_dataset.py
# Ubuntu Linux
NUM_IMAGES=5000 blender -b --python src/generate_autoencoder_dataset.py
& "C:\Program Files\Blender Foundation\Blender 5.1\blender.exe" -b --python src/data_gen_anomalous.py
# Trains on GPU, evaluates reconstruction, and outputs 3-panel error heatmap
python src/train_autoencoder_pytorch.py
The script automatically generates models/reconstruction_analysis.png plotting:
| Anomaly Heatmap: Absolute pixel reconstruction residual ($ | I - \hat{I} | $). |
This project is licensed under the MIT License.