mlsd_pytorch

Pytorch implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Detection"

update 2021.07.20

We have push our training code in mlsd_pytorch/

detail

model img_size sAP10
mlsd_tiny (this repo) 512 56.4
mlsd_tiny (in the paper) 512 58.0
mlsd_large (this repo) 512 59.6
mlsd_large (in the paper) 512 62.1

(this repo use: min_score=0.05, min_len=5, tok_k_lines= 500)


Pytorch implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Detection"

origin repo: https://github.com/navervision/mlsd

Overview

teaser--1-

mlsd_mobile

First figure: Comparison of M-LSD and existing LSD methods on GPU.
Second figure: Inference speed and memory usage on mobile devices.

demo

img

How to run demo

Install requirements

pip install -r requirements.txt

Run demo

The following demo test line detect (simplest):

python demo.py

The following demo run with flask in your local:

python demo_MLSD_flask.py

you can upload a image the click submit, see what happen.

http://0.0.0.0:5000/

Run in docker

Follow the instructions from https://docs.docker.com/engine/install/ubuntu,
https://github.com/NVIDIA/nvidia-container-runtime#docker-engine-setup and
https://docs.docker.com/compose/install/#install-compose-on-linux-systems to setup your environment.

  • Build the image
docker-compose build

  • Run the demo
docker-compose up

  • Run the flask demo
docker-compose -f docker-compose.yml -f docker-compose.flask.yml up

Citation

If you find M-LSD useful in your project, please consider to cite the following paper.

@misc{gu2021realtime,
    title={Towards Real-time and Light-weight Line Segment Detection},
    author={Geonmo Gu and Byungsoo Ko and SeoungHyun Go and Sung-Hyun Lee and Jingeun Lee and Minchul Shin},
    year={2021},
    eprint={2106.00186},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

GitHub

https://github.com/lhwcv/mlsd_pytorch