Mikehuntisbald / hawp

Holistically-Attracted Wireframe Parsing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Holistically-Attracted Wireframe Parsing: From Supervised Learning to Self-Supervised Learning

This is the official implementation of our paper.

Highlights

  • HAT Fields: A General and Robust Representation of Line Segments for Wireframe Parsing
  • HAWPv2: A state-of-the-art fully-supervised wireframe parser. Please checkout HAWPv2.md for its details.
  • HAWPv3: A state-of-the-art self-supervised wireframe parser. Please checkout HAWPv3.md for its details. HAWPv3 can be used as a good wireframe parser for the out-of-distribution images.

  • We provide a running example on the images of DTU dataset (scene24) as below.
    python -m hawp.ssl.predict --ckpt checkpoints/hawpv3-imagenet-03a84.pth  \
      --threshold 0.05  \
      --img ~/datasets/DTU/scan24/image/*.png \ 
      --saveto docs/figures/dtu-24 --ext png \

Data Downloading

Training and Testing datasets for HAWPv2
  • The training and testing data (including Wireframe dataset and YorkUrban dataset) for HAWPv2 can be downloaded via Google Drive. Many thanks to authors of these two excellent datasets!

  • You can also use the gdown to download the data in the terminal by

    gdown 134L-u9pgGtnzw0auPv8ykHqMjjZ2claO
    unzip data.zip

Installation

Anaconda
  • Clone the code repo: git clone https://github.com/cherubicXN/hawp.git.
  • Install ninja-build by sudo apt install ninja-build.
  • Create a conda environment by
conda create -n hawp python==3.9
conda activate hawp
conda develop .
  • Run the following command lines to install the dependencies of HAWP
# Install pytorch, please be careful for the version of CUDA on your machine
pip install torch==1.12.0+cu116 torchvision==0.13.0+cu116 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu116 
# Install other dependencies
pip install -r requirement.txt
  • Verify the installation.
python -c "import torch; print(torch.cuda.is_available())" # Check if the installed pytorch supports CUDA.
  • Downloading the offically-trained checkpoints of both HAWPv2 and HAWPv3.
sh downloads.sh
Docker

We also provide a Dockerfile. You could build the docker image by running the following command lines.

sudo docker build - < Dockerfile --tag hawp:latest

Citations

If you find our work useful in your research, please consider citing:

@article{HAWP-journal,
title = "Holistically-Attracted Wireframe Parsing: From Supervised to Self-Supervised Learning",
author = "Nan Xue and Tianfu Wu and Song Bai and Fu-Dong Wang and Gui-Song Xia and Liangpei Zhang and Philip H.S. Torr
journal = {arXiv:2210.12971},
year = {2022}
}

and

@inproceedings{HAWP,
title = "Holistically-Attracted Wireframe Parsing",
author = "Nan Xue and Tianfu Wu and Song Bai and Fu-Dong Wang and Gui-Song Xia and Liangpei Zhang and Philip H.S. Torr
",
booktitle = "IEEE Conference on Computer Vision and Pattern Recognition (CVPR)",
year = {2020},
}

Acknowledgment

We acknowledge the effort from the authors of the Wireframe dataset and the YorkUrban dataset. These datasets make accurate line segment detection and wireframe parsing possible. We also thank Rémi Pautrat for helpful discussions.

TODO

  • Training code for HAWPv3
  • Documentations
  • Google Colab Notebook

About

Holistically-Attracted Wireframe Parsing

License:MIT License


Languages

Language:Python 60.8%Language:C++ 32.6%Language:C 2.5%Language:MATLAB 1.9%Language:Shell 1.2%Language:Cuda 0.5%Language:Cython 0.2%Language:Makefile 0.2%Language:Dockerfile 0.1%