Skip to content

ant-research/scalelsd

Repository files navigation

ScaleLSD: Scalable Deep Line Segment Detection Streamlined

Zeran Ke1,2, Bin Tan2, Xianwei Zheng1, Yujun Shen2, Tianfu Wu3, Nan Xue2†

1Wuhan University   2Ant Group  3NC State University

teaser

⚙️ Installation

All codes are successfully tested on:

  • Ubuntu 22.04.5 LTS
  • CUDA 12.1
  • Python 3.10
  • Pytorch 2.5.1

First clone this repo:

git clone https://github.com/ant-research/scalelsd.git

Then create the conda environment and install the dependencies:

conda create -n scalelsd python=3.10
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt  
pip install -e .  # Install scalelsd locally

🔥🔍 Gradio Demo

Line Segment Detection

Before you started, please download our pre-trained models and place them into the models folder. Then run the Gradio demo:

python -m gradio_demo.inference

Line Matching

Because our line matching app is built on GlueStick with our ScaleLSD, you need to install GlueStick and download the weights of the GlueStick model. Then run the Gradio demo:

python -m gradio_demo.line_mat_gluestick

🚗 Inference

Quickly start use our models for line segment detection by running the following command:

python -m predictor.predict --img $[IMAGE_PATH_OR_FOLDER]

You can also specify more params by:

python -m predictor.predict \
    --ckpt $[MODEL_PATH] \
    --img $[IMAGE_PATH_OR_FOLDER] \
    --ext $[png/pdf/json] \
    --threshold 10 \
    --junction-hm 0.1 \
    --disable-show
OPTIONS:
  --ckpt CKPT, -c CKPT
                        Path to the checkpoint file.
  --img IMG, -i IMG     Path to the image or folder containing images.
  --ext EXT, -e EXT     Output file extension (png/pdf/json).
  --threshold THRESHOLD, -t THRESHOLD
                        Threshold for line segment detection.
  --junction-hm JUNCTION_HM, -jh JUNCTION_HM
                        Junction heatmap threshold.
  --num-junctions NUM_JUNCTIONS, -nj NUM_JUNCTIONS
                        Max number of junctions to detect.
  --disable-show        Disable showing the results.
  --use_lsd             Use LSD-Rectifier for line segment detection.
  --use_nms             Use Non-Maximum Suppression (NMS) for junction detection.

📖 Related Third-party Projects

📝 Citation

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

@inproceedings{ScaleLSD,
    title = {ScaleLSD: Scalable Deep Line Segment Detection Streamlined},
    author = {Zeran Ke and Bin Tan and Xianwei Zheng and Yujun Shen and Tianfu Wu and Nan Xue},
    booktitle = "IEEE Conference on Computer Vision and Pattern Recognition (CVPR)",
    year = {2025},
}

About

[CVPR 2025 ] ScaleLSD: Scalable Deep Line Segment Detection Streamlined

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages