Zeran Ke1,2, Bin Tan2, Xianwei Zheng1, Yujun Shen2, Tianfu Wu3, Nan Xue2†
1Wuhan University 2Ant Group 3NC State University
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.gitThen 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 locallyBefore you started, please download our pre-trained models and place them into the models folder. Then run the Gradio demo:
python -m gradio_demo.inferenceBecause 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_gluestickQuickly 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-showOPTIONS:
--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.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},
}