Giter VIP home page Giter VIP logo

mapgeneralization's Introduction

Generalizing Doors in Technical Drawings using Graph Neural Networks

By Christoffer P. Simonsen, Frederik M. Thiesson, Mark P. Philipsen, and Thomas B. Moeslund

[2020/06/17: Master thesis defense & project ended]

[2021/01/29: data/code/models available]

[2021/04/20: Paper accepted at ICIP 2021]

Introduction

This repository contains the code & links to annotation data for our ICIP 2021 submission: 'Generalizing Doors in Technical Drawings using Graph Neural Networks'. Here, we present how floor plan elements can be recognized by constructing graphs from the primitives in dxf files and performing node classification using Graph Neural Networks.

Requirements

  • OpenCV
  • Python 3
  • pip3 torch ezdxf

sudo apt-get install python3-tk

Our code has been tested using torch==1.5.1 & pytorch-lightning==0.8.3 on a Threadripper 2950x and Nvidia 2060 GPU machine with CUDA 10.0 installed.

Data

Our pubic dataset is available in the data/ directory. The dataset consists of all of the tools and files shown in Figure

dataset_creation_and_content

The data is available as ready to use labeled graphs stored as .gpickle files. In addition, we provide the original dxf files as well as tools for extracting the graphs and generating rasterized floor plan images.

More details about the RUB dataset and other floorplan datasets see datasets.pdf in the data/ directory.

Tools

DXF -> Line data -> Graph: To extract graphs from dxf files use DxfReader.extract_data() to create line data and DxfReader.convert_data_to_graph() to convert it to a graph - see main.py

Annotate graphs: Use annotation_tool.py to annotate the graphs or use our annotations in /data/labels

Normalize graphs: Use xx.py to scale the graphs and labels to a normalized scale.

Convert to png: from https://askubuntu.com/questions/612169/can-i-convert-a-dxf-to-png-or-jpg-with-a-command-tool

sudo apt install libreoffice texlive-extra-utils

  • libreoffice --headless --convert-to pdf A1322PE-0.dxf
  • pdfcrop A1322PE-0.pdf
  • gs -sDEVICE=png16m -dNOPAUSE -dBATCH -dSAFER -sOutputFile=A1322PE-0.png A1322PE-0-crop.pdf

or use dxf2png.py -l <list_of_dxf_files>.txt

NB: fails to render arcs correctly

Usage

Try network

A pre-trained model can be downloaded using the script in /trained_models. Use mode flag to decide whether to perform "node" or "element" prediction.

python predict.py --mode=node --graph=test.npy

Train network

Configure model in config.py

python main.py

Evaluate predictions

Performs both node- and element level evaluation.

python eval.py --mode=node --model=/trained_models/model.pt

Citation

Please consider citing:

TODO

mapgeneralization's People

Contributors

chrps avatar fredthiesson avatar markpp avatar

Stargazers

Yang Mingzhuo avatar leanAI avatar STYLIANOS IORDANIS avatar  avatar wincenzo avatar BYDGDS432 avatar  avatar MOhamed ElMesawy avatar

Watchers

 avatar Kristian Vester avatar  avatar  avatar

mapgeneralization's Issues

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.