Spaces:
Runtime error
Runtime error
Nan Xue
commited on
Commit
Β·
26cb13b
1
Parent(s):
4c954ae
update
Browse files
README.md
CHANGED
|
@@ -1,117 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
<sup>1</sup>Wuhan University   <sup>2</sup>Ant Group  <sup>3</sup>NC State University
|
| 14 |
-
|
| 15 |
-
</div>
|
| 16 |
-
|
| 17 |
-
<!-- <img src="assets/teaser.jpg" width="100%"> -->
|
| 18 |
-
|
| 19 |
-

|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
## βοΈ Installtion
|
| 23 |
-
|
| 24 |
-
All codes are succefully tested on:
|
| 25 |
-
|
| 26 |
-
- Ubuntu 22.04.5 LTS
|
| 27 |
-
- CUDA 12.1
|
| 28 |
-
- Python 3.10
|
| 29 |
-
- Pytorch 2.5.1
|
| 30 |
-
|
| 31 |
-
First clone this repo:
|
| 32 |
-
|
| 33 |
-
```bash
|
| 34 |
-
git clone https://github.com/ant-research/scalelsd.git
|
| 35 |
-
```
|
| 36 |
-
|
| 37 |
-
Then create the conda eviroment and install the dependencies:
|
| 38 |
-
```bash
|
| 39 |
-
conda create -n scalelsd python=3.10
|
| 40 |
-
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
|
| 41 |
-
pip install -r requirements.txt
|
| 42 |
-
pip install -e . # Install scalelsd locally
|
| 43 |
-
```
|
| 44 |
-
|
| 45 |
-
## π₯π Gradio Demo
|
| 46 |
-
|
| 47 |
-
### Line Segment Detection
|
| 48 |
-
Before you started, please download our pre-trained [models](https://huggingface.co/cherubicxn/scalelsd) and place them into the `models` folder. Then run the Gradio demo:
|
| 49 |
-
```bash
|
| 50 |
-
python -m gradio_demo.inference
|
| 51 |
-
```
|
| 52 |
-
|
| 53 |
-
### Line Matching
|
| 54 |
-
Because our line matching app is built on GlueStick with our ScaleLSD, you need to install [GlueStick](https://github.com/cvg/GlueStick) and download the weights of the GlueStick model. Then run the Gradio demo:
|
| 55 |
-
```bash
|
| 56 |
-
pythonb -m gradio_demo.line_mat_gluestick
|
| 57 |
-
```
|
| 58 |
-
|
| 59 |
-
## π Inference
|
| 60 |
-
|
| 61 |
-
Quickly start use our models for line segment detection by running the following command:
|
| 62 |
-
```bash
|
| 63 |
-
python -m predictor.predict --img $[IMAGE_PATH_OR_FODER]
|
| 64 |
-
```
|
| 65 |
-
|
| 66 |
-
You can also specify more params by:
|
| 67 |
-
|
| 68 |
-
```bash
|
| 69 |
-
python -m predictor.predict \
|
| 70 |
-
--ckpt $[MODEL_PATH] \
|
| 71 |
-
--img $[IMAGE_PATH_OR_FODER] \
|
| 72 |
-
--ext $[png/pdf/json] \
|
| 73 |
-
--threshold 10 \
|
| 74 |
-
--junction-hm 0.1 \
|
| 75 |
-
--disable-show
|
| 76 |
-
```
|
| 77 |
-
|
| 78 |
-
```bash
|
| 79 |
-
OPTIONS:
|
| 80 |
-
--ckpt CKPT, -c CKPT
|
| 81 |
-
Path to the checkpoint file.
|
| 82 |
-
--img IMG, -i IMG Path to the image or folder containing images.
|
| 83 |
-
--ext EXT, -e EXT Output file extension (png/pdf/json).
|
| 84 |
-
--threshold THRESHOLD, -t THRESHOLD
|
| 85 |
-
Threshold for line segment detection.
|
| 86 |
-
--junction-hm JUNCTION_HM, -jh JUNCTION_HM
|
| 87 |
-
Junction heatmap threshold.
|
| 88 |
-
--num-junctions NUM_JUNCTIONS, -nj NUM_JUNCTIONS
|
| 89 |
-
Max number of junctions to detect.
|
| 90 |
-
--disable-show Disable showing the results.
|
| 91 |
-
--use_lsd Use LSD-Rectifier for line segment detection.
|
| 92 |
-
--use_nms Use Non-Maximum Suppression (NMS) for junction detection.
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
## π Related Third-party Projects
|
| 97 |
-
|
| 98 |
-
- [HAWPv3](https://github.com/cherubicXN/hawp/tree/main)
|
| 99 |
-
- [DeepLSD](https://github.com/cvg/DeepLSD)
|
| 100 |
-
- [Progressive-x](https://github.com/danini/progressive-x/tree/vanishing-points)
|
| 101 |
-
- [GlueStick](https://github.com/cvg/GlueStick)
|
| 102 |
-
- [GlueFactory](https://github.com/cvg/glue-factory)
|
| 103 |
-
- [LiMAP](https://github.com/cvg/limap)
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
## π Citation
|
| 107 |
-
|
| 108 |
-
If you find our work useful in your research, please consider citing:
|
| 109 |
-
|
| 110 |
-
```bash
|
| 111 |
-
@inproceedings{ScaleLSD,
|
| 112 |
-
title = {ScaleLSD: Scalable Deep Line Segment Detection Streamlined},
|
| 113 |
-
author = {Zeran Ke and Bin Tan and Xianwei Zheng and Yujun Shen and Tianfu Wu and Nan Xue},
|
| 114 |
-
booktitle = "IEEE Conference on Computer Vision and Pattern Recognition (CVPR)",
|
| 115 |
-
year = {2025},
|
| 116 |
-
}
|
| 117 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: ScaleLSD
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.33.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|