Giter Site home page Giter Site logo

marifl / floor_plan_generation_using_gnns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mo7amed7assan1911/floor_plan_generation_using_gnns

0.0 0.0 0.0 97.17 MB

Gaduation Project: Residential Floor Plan Generation Using Deep Learning Techniques

Shell 0.01% Python 4.22% Jupyter Notebook 95.71% Dockerfile 0.07%

floor_plan_generation_using_gnns's Introduction

Gaduation Project: Residential Floor Plan Generation Using Deep Learning Techniques

Our project provides a user-friendly software solution that minimizes the gap between the complexity of designing residential floor plans and the capabilities of non-technical users. users can input the boundary of their piece of ground and their preferences which are then seamlessly processed by our advanced AI model to generate customized floor plans.

image

Dataset

  • The source dataset is Rplan Dataset, it is a dataset consists of about 80k floor plans as images.
  • First, we converted the image-based RPlan dataset to a geometry-based dataset, this conversion helped us with some benefits:
    • Accurate Representation.
    • Geometric Operations such as buffers, and intersections.
  • Then, we created a customized dataset as Graphs to be a new version of the Rplan floor plans. This conversion helped us train the GAT-Net model. you can see this work from this notebook

Our full architecture consists of 2 stages:

  1. Predicting room centroids. Using CNN model.
  2. Best room size estimation Using GNN model [Our work in this repo]

Below, is the full architecture we used to take user input to generate his final layout.

image

  • User inputs:
    • The boundary of his piece of ground and the position of the front door.
    • His preferences such as the number of rooms, bathrooms, and kitchens.
  • User gets:
    • Final layout for his floor plan.
    • 3D model for his floor plan.

We will focus in this repository on the second stage to get the best room size estimations using the GNN model.


Preprocessing

Creation of our customized dataset [Graph Based RPlan]:

  • As we said before, the Rplan dataset is an image-based dataset and we converted it to Geometric based using the idea of contours and convert each one to a polygon. Now we will convert these polygons into graphs.
  • For each floor plan two types of graphs were created: one representing the floor plan itself and another representing the boundary of the floor plan.
  • The process of creating the graphs involved the following steps:
    • Polygon-to-Node Conversion: The nodes were assigned features such as the type of polygon (e.g., room, bathroom), the centroid's X and Y coordinates, the room size (expressed as the ratio of the room's area to the total floor plan area), and the width and height of the square bounding the polygon. Also, the boundary graph was created.
    • Connections - Edges - between the nodes: Real connections, Living to all connections, and All-to-All connections.

You could see how this work is done from this notebook.

Below, is a floor plan from the source dataset as images and the corresponding generated graphs.

image

We utilized the Living-to-All connection type in our model since the coming centroids from the CNN model lack information about the real connections between these nodes.

To compensate for the model's reduced ability to learn from real neighboring rooms, we incorporated attention mechanisms in our layers. These mechanisms aid in identifying the crucial nodes for each node, enabling the model to focus on relevant information.

A pre-model to get intuitions before designing our GAT-Net model to get room size estimations.

  • During our experimentation, for classifying room types model we compared the performance of two types of graph convolutional layers: Graph Convolutional Networks (GCN) and Graph Attention Networks (GAT) in 50 epochs
    • GCN achieved 68% accuracy.
    • GAT achieved 94% accuracy, due to its attention mechanism.

For this reason and the usage of the attention mechanism, I decided to use the GATConv layers as the core of our model.

You can see how this work is done from this notebook

How we handled the problem of Over Smoothing after just 2 layers in Graph Neural Networks

To address this, we introduced the concept of residual connections. However, instead of employing skip connections, we utilized CONCATENATION connections to preserve and retain the essential features during the learning process.


GAT-Net model: A Residual Graph Attention Network for Floor Plan Analysis.

Name GAT-Net because The core of our model is the Graph Attention Network (GAT) architecture, customized for floor plan analysis, and to highlight its ability to extract meaningful insights from floor plan graphs using attention mechanisms.

image

Train process

  • The training process of GAT-Net involved training the model on an Nvidia P100 GPU with specific hyperparameters:
    • Number of Epochs = 300 epoc epo.
    • Learning Rate = 0.001
    • Optimizer: Adam
    • weight decay: 3e-5
    • Loss: Mean Square Error (MSE)
    • LR Scheduler gamma value: 0.950.

You could see how the GAT-Net is designed and implemented from this notebook.

Or you could run directly the main.py file which needs inputs from the CNN model, but I provided an example inside it.


Results of the GAT-Net model on the test set

image

You could see how we tested our model on the test set from this notebook


Getting Started

To get started with the project, you need to install the required dependencies.

Thses steps will help you run the main.py and User_constrains_to_floor_plan.ipynb files. As, they don't need the dataset to be downloaded.

Dependencies

  • Python > 3.9
  • requirements.txt

Installation

  1. Clone the repo
git clone https://github.com/mo7amed7assan1911/Floor_Plan_Generation_using_GNNs.git
cd Floor_Plan_Generation_using_GNNs
  1. install the required dependencies
pip install -r requirements.txt

For Docker users

Run the following commands to build the docker image and run the container

docker run mo7amed7assan1911/floor-plan-generation-using-gnns:latest

How to test the GAT-Net model

  • You could test the model on the testset from this notebook.

  • You could use the User_constrains_to_floor_plan.ipynb notebook to get the user inputs and then test the model on them.

  • You could directly run the main.py file which needs inputs from the CNN model, but I provided an example inside it.

floor_plan_generation_using_gnns's People

Contributors

mo7amed7assan1911 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.