M-LSD is a machine learning model for detecting wireframes.

elegirl_admin

ailia.AI

ailia.AI Editorial Team

Here’s an introduction to “M-LSD,” a machine learning model available for use with the ailia SDK. By utilizing the ailia SDK and ailia MODELS, which are edge-friendly inference frameworks, you can easily implement AI functionality into your applications.

Summary of M-LSD

M-LSD is a machine learning model developed by NAVER for detecting wireframes of input objects. It can accurately detect the outlines of objects such as paper or books, making it suitable for tasks like preprocessing for OCR.

Source:https://github.com/navervision/mlsd

Towards Real-time and Light-weight Line Segment Detection

Previous deep learning-based line segment detection (LSD) suffer from the immense model size and high computational…

arxiv.org

M-LSD Architecture

The conventional approach to line detection involved complex setups with multiple modules. In M-LSD, however, line detection is achieved in a single shot, enabling fast processing.

Source:https://arxiv.org/pdf/2106.00186.pdf

MobileNetV2 is used as the backbone, with additional blocks added in the later stages to generate heatmaps.

Source:https://arxiv.org/pdf/2106.00186.pdf

The line segment is defined as follows, represented by Tri-Points (TP). It is expressed as the center point represented by lc, along with the difference to the starting point, ds, and the difference to the ending point, de.

Source:https://arxiv.org/pdf/2106.00186.pdf

The output of the AI model consists of three vectors:

  1. A vector ( lc ) representing the line segment’s center points, calculated using the TopK Layer from the Center map, resulting in a shape of (1, 200, 2).
  2. A score, representing the confidence of the line segments, with a shape of (1, 200).
  3. A vector representing the displacement from the center point to the starting point and the ending point of the line segment, known as the Displacement map, with a shape of (1, 256, 256, 4).

By adding these three vectors outputted by the AI model—center point, starting point, and ending point—you can compute the line segments.

Source:https://arxiv.org/pdf/2106.00186.pdf

The dataset used consists of Wireframe and YorkUrban datasets.

Source:https://arxiv.org/pdf/2106.00186.pdf

How to use M-LSD

You can use the following command to perform recognition from a webcam. It is compatible with ailia SDK version 1.2.8 or later.

$ python3 mlsd.py -v 0

ailia-models/line_segment_detection/mlsd at master · axinc-ai/ailia-models

(Image from…

github.com

Here is an example of usage.

https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FGkJy7qwdiy0%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DGkJy7qwdiy0&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FGkJy7qwdiy0%2Fhqdefault.jpg&key=a19fcc184b9711e1b4764040d3dc5c07&type=text%2Fhtml&schema=youtube

Ax Corporation is a company specializing in practical AI solutions, developing the ailia SDK for cross-platform, GPU-accelerated inference. From consulting to model creation, SDK provision, AI-based app and system development, to support, we provide comprehensive solutions for AI-related needs. Feel free to reach out to us for any inquiries.