sunset1995 / HorizonNet

Pytorch implementation of HorizonNet: Learning Room Layout with 1D Representation and Pano Stretch Data Augmentation.
https://sunset1995.github.io/HorizonNet/
MIT License
324 stars 88 forks source link
360-photo computer-vision cvpr2019 horizonnet pano-stretch-augmentation room-layout

HorizonNet

This is the implementation of our CVPR'19 " HorizonNet: Learning Room Layout with 1D Representation and Pano Stretch Data Augmentation" (project page).

Update

Feature

This repo is a pure python implementation that you can:

Method overview

Installation

Pytorch installation is machine dependent, please install the correct version for your machine. The tested version is pytorch 1.8.1 with python 3.7.6.

Dependencies (click to expand) - numpy - scipy - sklearn - Pillow - tqdm - tensorboardX - opencv-python>=3.1 (for pre-processing) - pylsd-nova - open3d>=0.7 (for layout 3D viewer) - shapely

Download

Dataset

Pretrained Models

Plase download the pre-trained model here

Inference on your images

In below explaination, I will use assets/demo.png for example.

1. Pre-processing (Align camera rotation pose)

2. Estimating layout with HorizonNet

3. Layout 3D Viewer

Your own dataset

See tutorial on how to prepare it.

Training

To train on a dataset, see python train.py -h for detailed options explaination.\ Example:

python train.py --id resnet50_rnn

Quantitative Evaluation - Cuboid Layout

To evaluate on PanoContext/Stanford2d3d dataset, first running the cuboid trained model for all testing images:

python inference.py --pth ckpt/resnet50_rnn__panos2d3d.pth --img_glob "data/layoutnet_dataset/test/img/*" --output_dir output/panos2d3d/resnet50_rnn/ --force_cuboid

To get the quantitative result:

python eval_cuboid.py --dt_glob "output/panos2d3d/resnet50_rnn/*json" --gt_glob "data/layoutnet_dataset/test/label_cor/*txt"

If you want to:

:clipboard: The quantitative result for the released resnet50_rnn__panos2d3d.pth is shown below:

Testing Dataset 3D IoU(%) Corner error(%) Pixel error(%)
PanoContext 83.39 0.76 2.13
Stanford2D3D 84.09 0.63 2.06
All 83.87 0.67 2.08

Quantitative Evaluation - General Layout

TODO

Acknowledgement

Citation

@inproceedings{SunHSC19,
  author    = {Cheng Sun and
               Chi{-}Wei Hsiao and
               Min Sun and
               Hwann{-}Tzong Chen},
  title     = {HorizonNet: Learning Room Layout With 1D Representation and Pano Stretch
               Data Augmentation},
  booktitle = {{IEEE} Conference on Computer Vision and Pattern Recognition, {CVPR}
               2019, Long Beach, CA, USA, June 16-20, 2019},
  pages     = {1047--1056},
  year      = {2019},
}