Skip to content

Organizational Graph Generation for Structured Architectural Floor Plan Dataset

Notifications You must be signed in to change notification settings

luyueheng/CubiGraph5K

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CubiGraph5K

Code and dataset for CubiGraph5K: Organizational Graph Generation for Structured Architectural Floor Plan Dataset (CAADRIA 2021)

This dataset is a collection of graph representations generated by the proposed algorithms, using the floor plans in the popular CubiCasa5K dataset as inputs. The aim of this contribution is to provide a matching dataset that could be used to train neural networks on enhanced floor plan parsing, analysis and generation in future research.

Requirements

  • Python3
  • BeautifulSoup
  • Shapely

Usage

  1. Calculate room relations and generate graph
# Folder to store SVG model, provided in CubiCasa5K as well
file_path = '/high_quality_architectural/41/'.strip('/')
# Folder of CubiCasa5K data
input_location = 'cubicasa5k'

with open(os.path.join(input_location, file_path, 'model.svg')) as f:
    content = f.read()
soup = BeautifulSoup(content, 'lxml')
# Create a Plan instance using SVG
plan = Plan(soup.find('svg'))
# Calculate room relation
plan.generate_room_relation()

# See graph as adjacency list
# 0 - Not-connect, 1 - Adjacent, 2 - Door-connect
print(plan.get_adjacency_list())
  1. Generate graph diagram as SVG
# Folder where you want to store the output graph diagram
output_location = 'cubigraph5k'

with open(os.path.join(output_location, 'svg', 'graph.svg'), 'w') as output:
    output.write(str(plan.generate_relation_svg()))
  1. View all room instances as list
print(list(plan.name2room.keys()))
# Output: ['Kitchen_1', 'Dining_1', 'Entry_1', 'LivingRoom_1', 'Bedroom_1', 'Garage_1', 'Bedroom_2', 'Bedroom_3', 'Bath_1', 'Storage_1', 'Storage_2', 'Other_1', 'Bath_2', 'Entry_2']
  1. Calculate shortest path between two rooms
print(plan.shortest_paths_between_two_rooms(start='Entry_2', end='Bath_1'))
# Output: [['Entry_2', 'Entry_1', 'LivingRoom_1', 'Bedroom_3', 'Bath_1']]

Dataset

You can download original CubiCasa5K dataset from here and extract the .zip file to /cubicasa5k folder.

The corresponding CubiGraph5K dataset is in /dataset/data.json.

Example: Plan 41

{
    "41": { # plan id, same as CubiCasa5K
        "file_path": "/high_quality_architectural/41/", # file path in CubiCasa5K
        "room_type_count": { # number of instances
            "Kitchen": 1, 
            "Dining": 1, 
            "Entry": 2, 
            "LivingRoom": 1, 
            "Bedroom": 3, 
            "Garage": 1, 
            "Bath": 2, 
            "Storage": 2, 
            "Other": 1
        }, 
        "graph": { # graph as adjacency list, 1 - adjacent, 2 - door-connect
            "Kitchen_1": {"Dining_1": 1, "Storage_2": 2}, 
            "Dining_1": {"Kitchen_1": 1, "Entry_1": 1, "LivingRoom_1": 1}, 
            "Entry_1": {"Dining_1": 1, "LivingRoom_1": 1, "Bedroom_1": 2, 
            "Bedroom_2": 2, "Bath_2": 2, "Entry_2": 2}, 
            "LivingRoom_1": {"Dining_1": 1, "Entry_1": 1, "Bedroom_3": 2}, 
            "Bedroom_1": {"Entry_1": 2}, 
            "Garage_1": {}, 
            "Bedroom_2": {"Entry_1": 2, "Bath_2": 2}, 
            "Bedroom_3": {"LivingRoom_1": 2, "Bath_1": 2, "Storage_1": 2}, 
            "Bath_1": {"Bedroom_3": 2, "Storage_2": 2, "Other_1": 2}, 
            "Storage_1": {"Bedroom_3": 2}, 
            "Storage_2": {"Kitchen_1": 2, "Bath_1": 2}, 
            "Other_1": {"Bath_1": 2}, 
            "Bath_2": {"Entry_1": 2, "Bedroom_2": 2}, 
            "Entry_2": {"Entry_1": 2}
        }, 
        "diameter": 5 # other attributes
    },
    ...
}

The file paths of floor plans with invalid Shapely geomety or multiple stories are listed in /dataset/invalid.txt and dataset/multistory.txt for reference.

Reference

CubiCasa5K

About

Organizational Graph Generation for Structured Architectural Floor Plan Dataset

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages