{"id":33174744,"url":"https://github.com/zhou13/lcnn","last_synced_at":"2025-11-20T20:01:45.847Z","repository":{"id":44470683,"uuid":"185550840","full_name":"zhou13/lcnn","owner":"zhou13","description":"LCNN: End-to-End Wireframe Parsing","archived":false,"fork":false,"pushed_at":"2024-08-12T06:03:47.000Z","size":2460,"stargazers_count":489,"open_issues_count":2,"forks_count":92,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-08-12T07:26:25.374Z","etag":null,"topics":["cnn","corner","corner-detection","corner-detector","deep-learning","deep-neural-networks","line","line-detection","line-detector","pytorch","wireframe"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhou13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-08T07:03:02.000Z","updated_at":"2024-08-12T06:03:50.000Z","dependencies_parsed_at":"2022-07-15T20:46:47.380Z","dependency_job_id":null,"html_url":"https://github.com/zhou13/lcnn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zhou13/lcnn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhou13%2Flcnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhou13%2Flcnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhou13%2Flcnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhou13%2Flcnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhou13","download_url":"https://codeload.github.com/zhou13/lcnn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhou13%2Flcnn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285503668,"owners_count":27182913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cnn","corner","corner-detection","corner-detector","deep-learning","deep-neural-networks","line","line-detection","line-detector","pytorch","wireframe"],"created_at":"2025-11-16T02:00:33.687Z","updated_at":"2025-11-20T20:01:45.835Z","avatar_url":"https://github.com/zhou13.png","language":"Python","funding_links":[],"categories":["References"],"sub_categories":["Papers - Scene level"],"readme":"# End-to-End Wireframe Parsing\n\nThis repository contains the official PyTorch implementation of the paper: _[Yichao Zhou](https://yichaozhou.com), [Haozhi Qi](http://haozhi.io), [Yi Ma](https://people.eecs.berkeley.edu/~yima/). [\"End-to-End Wireframe Parsing.\"](https://arxiv.org/abs/1905.03246) ICCV 2019_.\n\n## Introduction\n\n[L-CNN](https://arxiv.org/abs/1905.03246) is a conceptually simple yet effective neural network for detecting the wireframe from a given image. It outperforms the previous state-of-the-art wireframe and line detectors by a large margin. We hope that this repository serves as an easily reproducible baseline for future researches in this area.\n\n## Main Results\n\n### Qualitative Measures\n\n|     \u003cimg src=\"figs/000452_LSD.png\" width=\"180\"\u003e      |    \u003cimg src=\"figs/000452_AFM.png\" width=\"180\"\u003e    |     \u003cimg src=\"figs/000452_WF.png\" width=\"180\"\u003e      | \u003cimg src=\"figs/000452_LCNN.png\" width=\"180\"\u003e | \u003cimg src=\"figs/000452_GT.png\" width=\"180\"\u003e |\n| :--------------------------------------------------: | :-----------------------------------------------: | :-------------------------------------------------: | :------------------------------------------: | :----------------------------------------: |\n| [LSD](https://ieeexplore.ieee.org/document/4731268/) | [AFM](https://github.com/cherubicXN/afm_cvpr2019) | [Wireframe](https://github.com/huangkuns/wireframe) |                  **L-CNN**                   |                Ground Truth                |\n\nMore random sampled results can be found in the [supplementary material](https://yichaozhou.com/publication/1904lcnn/appendix.pdf) of the paper.\n\n### Quantitative Measures\n\nThe following table reports the performance metrics of several wireframe and line detectors on the [ShanghaiTech dataset](https://github.com/huangkuns/wireframe).\n\n|                                                      | ShanghaiTech (sAP\u003csup\u003e10\u003c/sup\u003e) | ShanghaiTech (AP\u003csup\u003eH\u003c/sup\u003e) | ShanghaiTech (F\u003csup\u003eH\u003c/sup\u003e) | ShanghaiTech (mAP\u003csup\u003eJ\u003c/sup\u003e) |\n| :--------------------------------------------------: | :-----------------------------: | :---------------------------: | :--------------------------: | :----------------------------: |\n| [LSD](https://ieeexplore.ieee.org/document/4731268/) |                /                |             52.0              |             61.0             |               /                |\n|  [AFM](https://github.com/cherubicXN/afm_cvpr2019)   |              24.4               |             69.5              |             77.2             |              23.3              |\n| [Wireframe](https://github.com/huangkuns/wireframe)  |               5.1               |             67.8              |             72.6             |              40.9              |\n|                      **L-CNN**                       |            **62.9**             |           **82.8**            |           **81.2**           |            **59.3**            |\n\n### Precision-Recall Curves\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"figs/PR-APH.svg\"  width=\"400\"\u003e\n\u003cimg src=\"figs/PR-sAP10.svg\" width=\"400\"\u003e\n\u003c/p\u003e\n\n## Code Structure\n\nBelow is a quick overview of the function of each file.\n\n```bash\n########################### Data ###########################\nfigs/\ndata/                           # default folder for placing the data\n    wireframe/                  # folder for ShanghaiTech dataset (Huang et al.)\nlogs/                           # default folder for storing the output during training\n########################### Code ###########################\nconfig/                         # neural network hyper-parameters and configurations\n    wireframe.yaml              # default parameter for ShanghaiTech dataset\ndataset/                        # all scripts related to data generation\n    wireframe.py                # script for pre-processing the ShanghaiTech dataset to npz\nmisc/                           # misc scripts that are not important\n    draw-wireframe.py           # script for generating figure grids\n    lsd.py                      # script for generating npz files for LSD\n    plot-sAP.py                 # script for plotting sAP10 for all algorithms\nlcnn/                           # lcnn module so you can \"import lcnn\" in other scripts\n    models/                     # neural network structure\n        hourglass_pose.py       # backbone network (stacked hourglass)\n        line_vectorizer.py      # sampler and line verification network\n        multitask_learner.py    # network for multi-task learning\n    datasets.py                 # reading the training data\n    metrics.py                  # functions for evaluation metrics\n    trainer.py                  # trainer\n    config.py                   # global variables for configuration\n    utils.py                    # misc functions\ndemo.py                         # script for detecting wireframes for an image\neval-sAP.py                     # script for sAP evaluation\neval-APH.py                     # script for APH evaluation\neval-mAPJ.py                    # script for mAPJ evaluation\ntrain.py                        # script for training the neural network\npost.py                         # script for post-processing\nprocess.py                      # script for processing a dataset from a checkpoint\n```\n\n## Reproducing Results\n\n### Installation\n\nFor the ease of reproducibility, you are suggested to install [miniconda](https://docs.conda.io/en/latest/miniconda.html) before following executing the following commands.\n\n```bash\ngit clone https://github.com/zhou13/lcnn\ncd lcnn\nconda create -y -n lcnn\nsource activate lcnn\n# Modify the command with your CUDA version: https://pytorch.org/\nconda install -y pytorch cudatoolkit=10.1 -c pytorch\nconda install -y tensorboardx -c conda-forge\nconda install -y pyyaml docopt matplotlib scikit-image opencv\nmkdir data logs post\n```\n\n### Pre-trained Models\n\nYou can download our reference pre-trained models from our [HuggingFace Repo](https://huggingface.co/yichaozhou/lcnn/tree/main/Pretrained). Those models were\ntrained with `config/wireframe.yaml` for 312k iterations. Use `demo.py`, `process.py`, and\n`eval-*.py` to evaluate the pre-trained models.\n\n### Detect Wireframes for Your Own Images\n\nTo test LCNN on your own images, you need download the pre-trained models and execute\n\n```Bash\npython ./demo.py -d 0 config/wireframe.yaml \u003cpath-to-pretrained-pth\u003e \u003cpath-to-image\u003e\n```\n\nHere, `-d 0` is specifying the GPU ID used for evaluation, and you can specify `-d \"\"` to force CPU inference.\n\n### Downloading the Processed Dataset\n\nMake sure `curl` is installed on your system and execute\n\n```bash\ncd data\nwget https://huggingface.co/yichaozhou/lcnn/resolve/main/Data/wireframe.tar.xz\ntar xf wireframe.tar.xz\nrm wireframe.tar.xz\ncd ..\n```\n\nAlternatively, you can download the pre-processed dataset\n`wireframe.tar.xz` manually from our [HuggingFace Repo](https://huggingface.co/yichaozhou/lcnn/tree/main/Data) and proceed\naccordingly.\n\n#### Processing the Dataset\n\n_Optionally_, you can pre-process (e.g., generate heat maps, do data augmentation) the dataset from\nscratch rather than downloading the processed one. **Skip** this section if you just want to use\nthe pre-processed dataset `wireframe.tar.xz`.\n\n```bash\ncd data\nwget https://huggingface.co/yichaozhou/lcnn/resolve/main/Data/wireframe_raw.tar.xz\ntar xf wireframe_raw.tar.xz\nrm wireframe_raw.tar.xz\ncd ..\ndataset/wireframe.py data/wireframe_raw data/wireframe\n```\n\n### Training\n\nThe default batch size assumes your have a graphics card with 12GB video memory, e.g., GTX 1080Ti or RTX 2080Ti. You may reduce the batch size if you have less video memory.\n\nTo train the neural network on GPU 0 (specified by `-d 0`) with the default parameters, execute\n\n```bash\npython ./train.py -d 0 --identifier baseline config/wireframe.yaml\n```\n\n## Testing Pretrained Models\n\nTo generate wireframes on the validation dataset with the pretrained model, execute\n\n```bash\n./process.py config/wireframe.yaml \u003cpath-to-checkpoint.pth\u003e data/wireframe logs/pretrained-model/npz/000312000\n```\n\n### Post Processing\n\nTo post process the outputs from neural network (only necessary if you are going to evaluate AP\u003csup\u003eH\u003c/sup\u003e), execute\n\n```bash\npython ./post.py --plot --thresholds=\"0.010,0.015\" logs/RUN/npz/ITERATION post/RUN-ITERATION\n```\n\nwhere `--plot` is an _optional_ argument to control whether the program should also generate\nimages for visualization in addition to the npz files that contain the line information, and\n`--thresholds` controls how aggressive the post processing is. Multiple values in `--thresholds`\nis convenient for hyper-parameter search. You should replace `RUN` and `ITERATION` to the\ndesired value of your training instance.\n\n### Evaluation\n\nTo evaluate the sAP (recommended) of all your checkpoints under `logs/`, execute\n\n```bash\npython eval-sAP.py logs/*/npz/*\n```\n\nTo evaluate the mAP\u003csup\u003eJ\u003c/sup\u003e, execute\n\n```bash\npython eval-mAPJ.py logs/*/npz/*\n```\n\nTo evaluate AP\u003csup\u003eH\u003c/sup\u003e, you first need to post process your result (see the previous section).\nIn addition, **MATLAB is required for AP\u003csup\u003eH\u003c/sup\u003e evaluation** and `matlab` should be under your\n`$PATH`. The **parallel computing toolbox** is highly suggested due to the usage of `parfor`.\nAfter post processing, execute\n\n```bash\npython eval-APH.py post/RUN-ITERATION/0_010 post/RUN-ITERATION/0_010-APH\n```\n\nto get the plot, where `0_010` is the threshold used in the post processing, and `post/RUN-ITERATION-APH`\nis the temporary directory storing intermediate files. Due to the usage of pixel-wise matching,\nthe evaluation of AP\u003csup\u003eH\u003c/sup\u003e **may take up to an hour** depending on your CPUs.\n\nSee the source code of `eval-sAP.py`, `eval-mAPJ.py`, `eval-APH.py`, and `misc/*.py` for more\ndetails on evaluation.\n\n### Citing End-to-End Wireframe Parsing\n\nIf you find L-CNN useful in your research, please consider citing:\n\n```\n@inproceedings{zhou2019end,\n author={Zhou, Yichao and Qi, Haozhi and Ma, Yi},\n title={End-to-End Wireframe Parsing},\n booktitle={ICCV 2019},\n year={2019}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhou13%2Flcnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhou13%2Flcnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhou13%2Flcnn/lists"}