joker727's picture
Initial clean deploy: Vastu AI floor plan generator
c05974a
|
Raw History Blame Contribute Delete
4.01 kB
---
title: Vastu Plan Generation
emoji: 🏠
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
pinned: false
---
# AI Floorplan Generator
### Dissertation Project β€” Hybrid GNN + Diffusion + NSGA-II Architecture
---
## What This Does
Generates and optimises 2D residential floor plans for Indian homes with respect to:
- **Vastu Shastra** compliance (15 rules, user-selectable)
- **Construction Cost** estimation (India-specific rates)
- **Climatic feasibility** suggestions (5 Indian climate zones)
- **Spatial quality** β€” adjacency, efficiency, compactness
Shows **Top 5 optimised floor plans** ranked by a multi-objective fitness score.
---
## How to Run
### Step 1 β€” Install dependencies
```bash
pip install -r requirements.txt
```
### Step 2 β€” Download the trained model weights
Copy the three checkpoint files from Google Drive into the `models/` folder:
```
models/graph_vae.pth ← Graph VAE (200 epochs, loss 2.15)
models/geometry_predictor.pth ← Geometry Predictor (500 epochs, loss 0.38)
models/best.pt ← YOLOv8 room detector (optional, mAP50 β‰ˆ 54%)
```
If these files are missing, the app still runs but falls back to a rule-based
rectangle packer instead of the trained AI pipeline.
### Step 3 β€” Run the app
```bash
streamlit run app.py
```
### Step 4 β€” Open in browser
```
http://localhost:8501
```
---
## Project Structure
```
vastu-plan-generation/
β”œβ”€β”€ app.py ← Main Streamlit GUI
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ models/ ← Trained weights (downloaded from Drive)
β”‚ β”œβ”€β”€ graph_vae.pth
β”‚ β”œβ”€β”€ geometry_predictor.pth
β”‚ └── best.pt
β”œβ”€β”€ core/
β”‚ β”œβ”€β”€ constants.py ← Room definitions, Vastu rules, cost rates
β”‚ β”œβ”€β”€ generator.py ← Bridges ML pipeline β†’ FloorPlan objects + scoring
β”‚ β”œβ”€β”€ ml_models.py ← GraphVAE + GeometryPredictor class definitions
β”‚ β”œβ”€β”€ ml_pipeline.py ← Rejection-sampling pipeline (Cells E + F port)
β”‚ └── visualizer.py ← Matplotlib floor plan rendering
└── README.md
```
---
## Pipeline numbers (training + validation)
| Stage | Setting | Result |
| ------------------ | -------------------------------------- | ----------------- |
| YOLOv8 detector | 1.2k images, 11 classes | mAP50 β‰ˆ 54% |
| Graph VAE | 3283 RAG graphs, 200 epochs | Final loss 2.15 |
| Geometry Predictor | 500 epochs, cosine LR + adjacency loss | Final MSE 0.38 |
| End-to-end | Rejection sampling (HouseGAN++ style) | 100/100 valid |
| | Underlying acceptance rate | 23% (~4 tries) |
---
## Architecture Pipeline
```
User Input (GUI)
↓
Graph VAE β†’ Generates room adjacency graphs
↓
Diffusion Stg 1 β†’ Graph β†’ Room bounding boxes (x,y,w,h)
↓
Diffusion Stg 2 β†’ Boxes β†’ Full floor plan with walls/doors
↓
Constraints Check β†’ Validates 7 hard structural constraints
↓
NSGA-II β†’ Optimises: AQ + SE + LC + VS + AC + Cost
↓
Top 5 Plans β†’ Displayed in GUI with full analysis
```
---
## Objective Functions
| Symbol | Name | Goal |
|--------|------|------|
| AQ | Adjacency Quality | MAXIMISE |
| SE | Spatial Efficiency | MAXIMISE |
| LC | Layout Compactness | MAXIMISE |
| VS | Vastu Score | MAXIMISE |
| AC | Area Compliance | MAXIMISE |
| CC | Construction Cost | MINIMISE |
---
## Room Classes (Indian-Specific)
`master_bedroom`, `bedroom_01/02/03`, `kitchen`, `living_room`, `dining_room`,
`common_bathroom`, `attached_bathroom`, `powder_room`, `foyer`,
`internal_corridor`, `external_corridor`, `pooja_room`, `utility_area`,
`balcony`, `study`
---
*Dissertation: AI Framework for Automated Generation and Optimisation of 2D Floorplans
w.r.t. Vastu Orientation, Cost Effectiveness & Climatic Feasibility*