/mlsd_pytorch

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

Primary LanguagePythonApache License 2.0Apache-2.0

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

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

demo

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}
}

License

Copyright 2021-present NAVER Corp.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.