Zaid-Faridi/Structural-Intelligence-System
GitHub: Zaid-Faridi/Structural-Intelligence-System
该项目构建了一条七阶段自主AI流水线,从2D平面图自动重建3D结构模型并进行基于工程约束的材料优化与区块链审计追踪。
Stars: 0 | Forks: 0
# 🏗️ 自主结构智能系统
## 🎯 Pipeline 阶段
| 阶段 | 模块 | 技术 | 用途 |
|-------|--------|------------|---------|
| 1 | `semantic_extractor.py` | Gemini 2.5 Flash VLM | 从平面图中提取房间拓扑结构、跨度和比例 |
| 2 | `wall_extractor.py` | OpenCV + U-Net (ResNet34) | 通过形态学滤波 + 深度学习分离承重墙 |
| 3 | `geometry_optimizer.py` | PuLP MIP Solver + NetworkX | 将带有噪声的 CV 输出强制转换为正交且无缝隙的平面图 |
| 4 | `model_generator.py` | Custom Python → Three.js | 将 2D 墙体转换为 3D 盒状网格(无浏览器端 CSG) |
| 5 | `material_optimizer.py` | WPM Math Engine | 结合硬约束对材料进行评分:跨度 > 5m → 淘汰 < 30 MPa 的材料 |
| 6 | `explainer.py` | Gemini 2.5 Flash + MD5 Cache | 生成带数字引用的结构依据说明 |
| 7 | `contracts/structural_audit` | Stellar Soroban (Rust) | 为每次分析提供不可变的链上审计追踪 |
## 🚀 快速开始
### 前置条件
- Python 3.10+
- Node.js 18+
- 一个 [Gemini API Key](https://aistudio.google.com/apikey)(免费层级)
### 1. 克隆并安装
```
git clone && cd iiitNR
# Backend
pip install -r requirements.txt
cp .env.example .env
# 编辑 .env 并添加您的 GEMINI_API_KEY
# Frontend
cd frontend && npm install && cd ..
```
### 2. 运行
```
# 终端 1:Backend(从 /backend 目录)
cd backend && python -m uvicorn main:app --reload
# 终端 2:Frontend
cd frontend && npm run dev
```
打开 **http://localhost:5173** → 上传平面图 → 点击 **Run Pipeline**。
## 📂 项目结构
```
iiitNR/
├── backend/
│ ├── main.py # FastAPI orchestrator (7-stage pipeline)
│ ├── semantic_extractor.py # Stage 1: Gemini VLM extraction
│ ├── wall_extractor.py # Stage 2: CV wall segmentation
│ ├── geometry_optimizer.py # Stage 3: MIP topological optimization
│ ├── model_generator.py # Stage 4: 3D mesh generation (no-CSG)
│ ├── material_optimizer.py # Stage 5: WPM material scoring
│ ├── explainer.py # Stage 6: AI justification engine
│ ├── geometry.py # Wall classification & span detection
│ ├── parser.py # DL parsing (MitUNet + KeypointCNN)
│ └── models.py # PyTorch model architectures
├── contracts/
│ └── structural_audit/ # Soroban smart contract (Rust)
│ └── src/lib.rs
├── frontend/
│ └── src/
│ ├── App.jsx # 3-panel glassmorphic dashboard
│ └── components/
│ └── ModelViewer.jsx # Three.js WebGL renderer
├── sample_inputs/ # Test floor plans (A, B, C)
├── tests/ # Unit tests
├── requirements.txt
└── .env.example
```
## 🧪 关键工程决策
- **无 CSG 前端**:所有布尔几何运算(在开口处分割墙体)均在 Python 中执行。前端仅渲染预计算好的 `BoxGeometry` 网格。
- **硬跨度约束**:如果任何房间的跨度超过 5.0m,抗压强度 < 30 MPa 的材料将被自动淘汰(score = 0)。
- **缓存失效**:解释缓存键是 `(element_id, material_id, span_m)` 的 MD5 哈希值,确保在结构尺寸发生变化时重新生成。
## 📜 License
MIT
标签:3D建模, AI工程, MITM代理, 凭据扫描, 区块链, 可视化界面, 建筑工程, 特权检测, 结构分析, 计算机视觉, 逆向工具