Submitted:
24 August 2026
Posted:
26 August 2026
You are already at the latest version
Abstract
Line-segment detection is fundamental to robotics, autonomous navigation, and industrial inspection. While transformer-based detectors achieve the highest accuracy, their deployment on microcontrollers remains impractical. The STM32N6, with its Neural-ART NPU, promises to enable deep vision at the extreme edge. However, existing detectors rely on attention, grid-sampling, and normalization, operators unsupported by the convolution-oriented NPU. This architectural mismatch is characterized operator by operator: these operators lack accelerator primitives, and the decoder's self-attention alone materializes a 39 MB tensor exceeding on-chip memory. To address this, NPLSD is introduced as a pair of NPU-compatible line-segment detectors. NPLSD-H retains the HGNetv2 backbone of LINEA and replaces the transformer head with a fully-convolutional design. NPLSD-M adapts the M-LSD-tiny trunk to the supported operator set. Warm-started from ImageNet and trained on Wireframe, NPLSD-H reaches sAP10 = 37.9 (35.9 int8); NPLSD-M reaches 41.9 (41.1 int8) with 0.62M parameters. A controlled ablation isolates the trunk as the only variable, and initialization alone accounts for 4.6 points.

Keywords:
line segment detection (LSD)
; neural processing unit (NPU)
; hardware-software co-design
; TinyML
; STM32N6
; edge AI
1. Introduction
Line-segment detection (LSD) is a cornerstone of visual perception for robotics, autonomous navigation, and industrial metrology. While classical methods such as LSD [1] and ELSED [2] have long served as practical solutions, their accuracy is limited in challenging scenarios. Deep learning has reshaped LSD in two waves. The first introduced convolutional approaches including L-CNN [3], HAWP [4,5], and F-Clip [6], demonstrating the superiority of end-to-end learning. DeepLSD [7] later combined learned gradients with classical refinement. The second wave brought transformer-based detectors such as LETR [8], DT-LSD [9], and LINEA [10], which set new state-of-the-art results. These models, however, are designed for GPUs. Even efficient variants like M-LSD [11] and EM-LSD [12] target mobile SoCs with substantial memory.
The embedded landscape has shifted with the integration of on-chip NPUs into microcontrollers. The STM32N6 pairs a Cortex-M55 with the Neural-ART NPU [13,14], a convolutional accelerator that raises throughput by an order of magnitude. The ST Edge AI toolchain [15] maps convolutional networks onto this accelerator.
Despite this promise, line-segment detection remains absent from NPU microcontrollers [16]. The primary impediment is architectural. Transformer detectors rely on attention, grid-sampling, and normalization, operators unsupported by convolution-oriented NPUs. These execute on the host CPU, and attention mechanisms can exceed the on-chip activation budget entirely. A transformer detector thus derives negligible benefit from the NPU.
This mismatch is concrete: LINEA-N’s backbone is expressible on the NPU, but its transformer encoder-decoder is not. The self-attention score tensor alone exceeds the available SRAM, and grid-sampling has no accelerator primitive. This gap motivates NPLSD, a pair of line-segment detectors designed for the NPU. Both variants are built from supported operators only. NPLSD-H retains the convolutional HGNetv2-B0 backbone and replaces the transformer head with a fully-convolutional design. NPLSD-M adapts the M-LSD-tiny trunk to the accelerator’s operator set. Every operator maps onto the NPU.
Both detectors are warm-started from ImageNet and trained on ShanghaiTech Wireframe with an identical head and recipe. NPLSD-H reaches (from-scratch: 33.3), so initialization accounts for 4.6 points. NPLSD-M reaches 41.9 with 4.2× fewer parameters. The trunk is the only variable, forming a controlled ablation. Since the NPU is an integer engine, both models are quantized to int8. Quantization costs 2.0 points on the dense trunk and 0.8 on the depthwise trunk.
The contributions of this paper are as follows:
- The transformer-NPU gap is characterized at the operator level. Profiling LINEA-N against the Neural-ART instruction set reveals that only its backbone is expressible on the accelerator; the decoder cannot fit on-chip at all.
- Two NPU-native detectors, NPLSD-H and NPLSD-M, are introduced. Both networks are constructed entirely from the supported operator set and share an identical head and training recipe, enabling a controlled ablation of the trunk.
- ImageNet warm-starting improves by 4.6 points at no architectural cost. The depthwise trunk loses only 0.8 points to int8 quantization, versus 2.0 for the dense trunk, while achieving higher accuracy with 4.2× fewer parameters.
The remainder of this paper is organized as follows. The transformer-NPU gap is characterized in Section 2. The NPLSD architectures and training are presented in Section 3, together with the int8 quantization procedure. Experimental results are reported in Section 4. Discussion and concluding remarks are provided in Section 5 and Section 6.
2. The NPU Gap: An Architectural Analysis
The characterization proceeds by establishing why transformer-based detectors cannot benefit from the STM32N6 NPU. Table 1 presents the operator mapping for LINEA-N, derived from its exported graph and the accelerator’s documented operator support.
The convolutional components of the HGNetv2-B0 backbone and the CNN cross-scale fusion in the hybrid encoder are mappable to the NPU. In contrast, the transformer-specific operators are not supported. GridSample, the bilinear sampling core of the line-attention deformable decoder, has no Neural-ART primitive and can only execute on the Cortex-M55. The same applies to LayerNorm, the attention Softmax, and the TopK and Gather operations for query selection.
Critically, the decoder’s self-attention operates over 1,100 queries and materializes an score tensor. This tensor is approximately 39 MB in floating-point, which exceeds the on-chip activation budget. The full decoder is therefore unplaceable. Only the backbone is expressible on the accelerator, and it represents a minority of the network’s computation. The transformer-specific operations are consequently relegated to the host CPU. The accelerator is thus architecturally wasted on a transformer detector. This is the gap that NPLSD is designed to close.
3. NPLSDH: Architecture and Training
This section presents the design and training of the two NPLSD variants. The architectures comprise a trunk for feature extraction, a lightweight fusion stage, and a shared dense head for line parameter regression. The training objective and optimization procedure are then formulated.
3.1. Design Principle
The design of NPLSDH is governed by a single, non-negotiable constraint: every operator must execute natively on the Neural-ART NPU. This requirement is not merely an optimization consideration; it is a fundamental precondition for the network to benefit from the STM32N6’s accelerator at all. The operators supported by the NPU include convolution, batch normalization (folded into convolution during inference), ReLU, the bounded Clip activation (ReLU6), element-wise addition, concatenation, nearest-neighbor resize, and max-pool. Conversely, attention, grid-sampling, layer normalization, softmax, and top-k selection are explicitly excluded from the NPU’s instruction set. Both NPLSD variants are therefore constructed exclusively from the supported operator set.
3.2. NPLSD-H Architecture
The NPLSDH architecture comprises three main components: backbone, neck, and head.
- Backbone: HGNetv2-B0 [17,18], the convolutional backbone used by LINEA, is adopted. It produces feature maps at strides 8, 16, and 32 with 256, 512, and 1024 channels, respectively. Unlike the detection-transformer usage, ordinary batch normalization is kept rather than frozen affine layers. This ensures that during quantization, each batch normalization layer folds cleanly into its preceding convolution. The backbone is warm-started from the publicly available ImageNet-pretrained HGNetv2-B0 weights, with the optional affine layers dropped; every remaining backbone tensor is initialized from the checkpoint. A from-scratch run of the identical architecture is kept as an ablation.
- Neck: A lightweight convolutional feature pyramid fuses the three backbone scales top-down. It uses 1x1 lateral convolutions, nearest-neighbor 2x upsampling (a supported NPU resize operation), and 3x3 smoothing convolutions. An additional upsampling stage produces a single stride-4 map. For a 320x320 input, this yields an 80x80 grid for the dense head.
- Head: An F-Clip-style dense line head [6] predicts a six-channel output per grid cell. This includes a line-center likelihood (one channel), a sub-pixel center offset (two channels), a half-length (one channel), and a double-angle orientation (two channels). The double-angle encoding, defined as , removes the 180-degree direction ambiguity inherent in line segments. The head emits raw feature maps. The center map is decoded off the NPU through a lightweight arithmetic pass comprising sigmoid activation, 3x3 max-pool non-maximum suppression, and per-peak endpoint reconstruction.
The complete network has 2.63M parameters, smaller than LINEA-N’s 3.9M. Its exported graph contains only Conv, ReLU, Add, Concat, Resize, and MaxPool nodes, all of which map onto the accelerator.
3.3. NPLSD-M: Adapting the M-LSD Trunk
On mobile SoCs, M-LSD-tiny remains the reference lightweight detector, reporting at 512-pixel input with 0.6M parameters [11]. Direct reuse of this trunk on the N6 is not feasible. The released model is float-only TFLite, whereas the integer accelerator does not execute floating-point convolutions. Its bilinear upsampling with aligned corners lacks a Neural-ART primitive, and the TFLite-style asymmetric padding triggers a code-generation fault. Furthermore, at 512-pixel resolution, a single early tensor of occupies 6.3 MB in int8, exceeding the N6’s 4.2 MB internal activation SRAM.
NPLSD-M is the accelerator-native redesign of this trunk, produced by the same methodology as NPLSD-H. The MobileNetV2 inverted-residual stack (blocks 0 through 10, taps at strides 4, 8, and 16) is warm-started from ImageNet. The A/B fusion blocks of M-LSD are retained, with their bilinear interpolation replaced by nearest-neighbor resize. Asymmetric pads become symmetric convolution padding, the four-channel input becomes standard RGB, and the M-LSD prediction head is replaced by the same F-Clip dense head used in NPLSD-H, at 320-pixel input. ReLU6 activations are retained as Clip nodes, which belong to the accelerator’s supported operator set. The exported graph holds 44 Conv, 20 Clip, 10 ReLU, 8 Add, 3 Concat, and 2 Resize nodes, with no Pad, for 0.62M parameters and 1.74 GMACC.
Since trunk choice is the only difference between the two variants, their comparison constitutes a controlled ablation of trunk families under a fixed head, loss, dataset, resolution, and schedule.
3.4. Training
Both variants are trained on the ShanghaiTech Wireframe benchmark. Ground-truth segments are rasterized into dense targets. A CenterNet-style Gaussian is placed on the center map at each ground-truth line center. Regression targets for offset, length, and angle are assigned to each positive center cell.
The loss function combines a penalty-reduced focal loss on the center map with L1 or smooth-L1 regression losses on the offset, length, and unit-normalized angle at positive cells. The total loss is defined as:
where balances the classification and regression terms.
Optimization is performed with AdamW using a cosine annealing learning rate schedule. Each model is trained for 120 epochs with a batch size of 16, selecting the checkpoint with the best validation . Input images are resized to 320x320. Evaluation is conducted using structural average precision (sAP) on the 128x128 reference space following the standard Wireframe benchmark protocol.
Warm-started from ImageNet, NPLSD-H achieves , while NPLSD-M reaches 41.9. Training NPLSD-H from scratch under the same recipe yields 33.3, indicating that ImageNet initialization contributes 4.6 points without any architectural modification. Notably, the accelerator operator set does not constitute the accuracy bottleneck; holding the graph fixed and varying only the initialization produces a larger accuracy shift than the gap between the two trunk families. Both results remain below transformer-based detectors, which is consistent with compact convolutional models evaluated at 320-pixel input.
Figure 1.
NPLSD architecture comprises two accelerator-native trunks and a shared dense head. The dense HGNetv2-B0 of NPLSD-H and the depthwise MobileNetV2 stack of NPLSD-M feed a six-channel F-Clip head at stride 4, followed by an arithmetic decode. Every operator (Conv, ReLU/Clip, Add, Concat, Resize, MaxPool) maps onto the Neural-ART NPU.
Figure 1.
NPLSD architecture comprises two accelerator-native trunks and a shared dense head. The dense HGNetv2-B0 of NPLSD-H and the depthwise MobileNetV2 stack of NPLSD-M feed a six-channel F-Clip head at stride 4, followed by an arithmetic decode. Every operator (Conv, ReLU/Clip, Add, Concat, Resize, MaxPool) maps onto the Neural-ART NPU.

3.5. Export and int8 Quantization
Since the Neural-ART is an integer engine, the configuration of record is the quantized one, and it is prepared entirely off-device. Each trained model is exported to ONNX at 320x320 input resolution and simplified to static shapes, yielding a clean graph over the supported operator set (the NPLSD-M graph is exported with symmetric padding from the start and contains no Pad node). Static int8 quantization [19] is then applied in QDQ (Quantize-Dequantize) format with per-channel weights, calibrated on 200 real Wireframe images; for NPLSD-M the bounded Clip activations are included in the quantized set. Quantization compresses the weights roughly fourfold, to 2.55 MB for NPLSD-H and 0.65 MB for NPLSD-M. All int8 results in Section 4 are produced by executing these quantized graphs in ONNX Runtime over the full validation split. The training notebooks and the evaluation code reproducing every accuracy figure are publicly available on Kaggle [20,21,22], together with the dataset and the ImageNet-pretrained trunk checkpoints [23].
4. Results
4.1. Qualitative Detections
Figure 2 shows NPLSD predictions on held-out ShanghaiTech Wireframe validation images spanning diverse indoor and outdoor man-made scenes. Across bedrooms, living rooms, facades, and terraces, the models recover the dominant scene structure, including wall, ceiling, window, door, and furniture edges together with the perspective convergence of facade and floor boundaries. These predictions are generated directly by the fully convolutional, accelerator-mappable networks. Fine, low-contrast, and heavily occluded segments are more frequently missed, with NPLSD-M recovering visibly more of the long structural edges, in line with its higher per-length recall (Table 5). The results show the complete set of raw decoded outputs rather than a curated subset, providing qualitative evidence that native line-segment detection on a microcontroller NPU can produce coherent wireframe reconstructions.
4.2. Accuracy on the Wireframe Benchmark
Table 2 lists structural average precision over the complete 462-image validation split, evaluated at the three standard matching thresholds. Six configurations are compared: each variant in fp32 and int8, together with the from-scratch NPLSD-H ablation pair. Warm-started NPLSD-H reaches ; after static quantization with 200 real calibration images (QDQ format, per-channel weights), the int8 network intended for the accelerator retains 35.9. NPLSD-M reaches 41.9 and maintains 41.1 in int8, a loss of 0.8 points compared with 2.0 for the dense trunk. Degradations of this order are typical when compact convolutional networks are quantized to int8 [24]. Precision and recall are affected almost uniformly, as the curves in Figure 3 indicate, so accuracy statements made for the fp32 model carry over to the quantized one. At a confidence threshold of 0.15, the warm NPLSD-H proposes 129 segments per image on average against 74.2 annotated (NPLSD-M: 165.5), a proposal surplus that MiLSD [25] also exhibits and that the ranked sAP protocol absorbs.
For context, Table 3 situates these results among published line detectors across hardware classes. GPU-class detectors such as HAWP [4] at 66.5 and L-CNN [3] at 62.8 assume workstation memory budgets. M-LSD-tiny [11] brought learned detection to mobile SoCs at 58.0, yet still relies on gigabytes of RAM. Below the mobile tier, the literature is, to our knowledge, empty. The only microcontroller results available are the 25k F-Clip baseline (10.6), MiLSD (24.1) [25], and the present work, all three originating from the same research effort, reflecting the novelty of this design space. Within this comparison, NPLSD-H improves by 11.8 points over MiLSD, and NPLSD-M by 17.0 points, with both networks constructed entirely from the accelerator’s supported operator set. NPLSD-M also closes 41 percent of the gap separating MiLSD from the mobile-SoC M-LSD-tiny, while remaining int8 and microcontroller-scale at 320-pixel input. For reference, the classical LSD algorithm of von Gioi et al. [1], evaluated on a desktop CPU, attains an of 8.8. The int8 NPLSD-M model achieves approximately 4.7 times this score while targeting substantially more resource-constrained hardware.
4.3. Cross-Dataset Generalization: YorkUrban
Following the standard protocol established by L-CNN, HAWP, F-Clip, LETR, and M-LSD [3,4,6,8,11], which train on Wireframe and report YorkUrban as a zero-shot test, both NPLSD variants are evaluated on the 102 YorkUrban images without any fine-tuning (Table 4). All published detectors exhibit a sharp drop on this transfer; GPU-class models retain 42 to 45 percent of their Wireframe , while M-LSD-tiny retains 42 percent. NPLSD-M retains 41 percent (17.2 of 41.9), indicating that the accelerator-constrained design does not compromise cross-dataset generalization. The observed drop is expected: YorkUrban contains outdoor scenes and annotates only lines along the dominant Manhattan directions, with 118.8 ground-truth lines per image. Out of domain, quantization costs NPLSD-M only 0.3 points.
Recall stratified by ground-truth length appears in Table 5. For the warm NPLSD-H, short and medium segments are recovered at 54.0 and 62.2 percent, and segments longer than 25 units of the label space at 44.0 percent. NPLSD-M leads across all buckets at 61.0, 65.5, and 48.0 percent, respectively. Compared with the from-scratch model, pretraining improves long-segment recall by 5.9 points, the largest per-bucket gain. A long-line deficit nevertheless persists. This pattern is consistent with expectations. MiLSD, built on the same center, length, and angle encoding, exhibits similar behavior [25]; thus, the effect appears to arise from the representation family rather than from the NPU constraint introduced here. Multi-scale heads would be a natural extension and remain compatible with the accelerator’s operator set.
The behavior of the dense head can be characterized through direct examination of its output maps. Figure 4 renders the raw output channels for one validation scene: center likelihood peaks at segment midpoints, the half-length map grows along extended structural edges, and the decoded orientation stays piecewise constant across surfaces that share a direction. Precisely these three quantities are assembled into segments by the arithmetic decode.
4.4. Model Footprint
NPLSD-H has 2.63M parameters and 2.69 GMACC at 320x320; NPLSD-M has 0.62M parameters and 1.74 GMACC. Quantized to int8, the NPLSD-H weights occupy 2.55 MB, compared with 10.05 MB in floating-point; NPLSD-M compresses to 0.65 MB (Figure 5). Both quantized weight files fit comfortably within microcontroller-class flash budgets, roughly four times smaller than their float counterparts. Notably, the 0.65 MB NPLSD-M is smaller than MiLSD-class detectors while achieving 17 points higher in .
5. Discussion and Limitations
NPLSD demonstrates that line-segment detection can be made compatible with a microcontroller NPU through co-design with the accelerator’s operator set. The controlled trunk ablation carries its own lesson. With head, loss, data, and schedule held fixed, the depthwise MobileNetV2 trunk outscores the dense HGNetv2 trunk by 5.2 int8 points at 4.2 times fewer parameters, and it is markedly more robust to quantization. Both variants are nevertheless retained. Depthwise and dense convolutions place very different demands on an accelerator’s MAC array and memory system; accuracy per parameter need not translate into accuracy per millisecond. Which trunk wins on silicon is a question this paper deliberately leaves to hardware evaluation.
Two limitations frame the contribution. First, accuracy: at in int8, NPLSD-M still trails transformer-based detectors and the 512-pixel mobile M-LSD-tiny. Knowledge distillation [27] and multi-scale heads are natural next steps, and warm-starting, previously listed as future work, is now measured at +4.6 points. Second, evaluation covers two datasets at a fixed resolution, and all results are simulation-level (ONNX Runtime). On-silicon latency, memory placement, and energy are outside the scope of this paper. Despite these limitations, NPLSD provides a baseline and methodology for NPU-ready geometric vision on microcontrollers.
6. Conclusions
This paper presented NPLSD, a pair of line-segment detectors designed for an NPU-equipped microcontroller. Motivated by an architectural gap, in which transformer detectors are largely inexpressible in a convolution accelerator’s operator set, both variants replace non-convolutional structure with a fully-convolutional design. By construction, every operator belongs to the Neural-ART supported set.
Warm-started on ShanghaiTech Wireframe, the 2.63M-parameter NPLSD-H reaches (35.9 int8) and the 0.62M-parameter NPLSD-M reaches 41.9 (41.1 int8), 17.0 points above the best prior microcontroller result. Static int8 quantization, the format the integer accelerator requires, costs under one point on the depthwise trunk. The controlled ablation shows that initialization (+4.6) matters as much as trunk choice (+5.2), and that neither is limited by the accelerator operator set. NPLSD establishes that accelerator-compatible line-segment detection on microcontrollers is feasible at useful accuracy. Closing the remaining accuracy gap through knowledge distillation, and characterizing both variants on silicon, remain future work.
References
- von Gioi, R.G.; Jakubowicz, J.; Morel, J.M.; Randall, G. LSD: A Fast Line Segment Detector with a False Detection Control. IEEE Trans. on Pattern Analysis and Machine Intelligence (TPAMI) 2010, 32, 722–732. [CrossRef]
- Suárez, I.; Buenaposada, J.M.; Baumela, L. ELSED: Enhanced Line SEgment Drawing. Pattern Recognition 2022, 127, 108619. arXiv:2108.03144, https://doi.org/10.1016/j.patcog.2022.108619. [CrossRef]
- Zhou, Y.; Qi, H.; Ma, Y. End-to-End Wireframe Parsing. In Proceedings of the IEEE/CVF Int. Conf. on Computer Vision (ICCV), 2019. L-CNN. arXiv:1905.03246.
- Xue, N.; Wu, T.; Bai, S.; Wang, F.D.; Xia, G.S.; Zhang, L.; Torr, P.H. Holistically-Attracted Wireframe Parsing. In Proceedings of the IEEE/CVF Conf. on Computer Vision and Pattern Recognition (CVPR), 2020. HAWP. arXiv:2003.01663.
- Xue, N.; Wu, T.; Bai, S.; Wang, F.D.; Xia, G.S.; Zhang, L.; Torr, P.H. Holistically-Attracted Wireframe Parsing: From Supervised to Self-Supervised Learning. IEEE Trans. on Pattern Analysis and Machine Intelligence (TPAMI) 2023. HAWPv2/v3. arXiv:2210.12971.
- Dai, X.; Gong, H.; Wu, S.; Yuan, X.; Ma, Y. Fully Convolutional Line Parsing. Neurocomputing 2022, 506, 1–11. F-Clip. arXiv:2104.11207, https://doi.org/10.1016/j.neucom.2022.07.026. [CrossRef]
- Pautrat, R.; Barath, D.; Larsson, V.; Oswald, M.R.; Pollefeys, M. DeepLSD: Line Segment Detection and Refinement with Deep Image Gradients. In Proceedings of the IEEE/CVF Conf. on Computer Vision and Pattern Recognition (CVPR), 2023. Line attraction field. arXiv:2212.07766.
- Xu, Y.; Xu, W.; Cheung, D.; Tu, Z. Line Segment Detection Using Transformers without Edges. In Proceedings of the IEEE/CVF Conf. on Computer Vision and Pattern Recognition (CVPR), 2021. LETR. arXiv:2101.01909.
- Janampa, S.; Pattichis, M. DT-LSD: Deformable Transformer-Based Line Segment Detection. In Proceedings of the Proceedings of the Winter Conference on Applications of Computer Vision (WACV), February 2025, pp. 3477–3486.
- Janampa, S.; Pattichis, M. LINEA: Fast and Accurate Line Detection Using Scalable Transformers, 2025, [arXiv:cs.CV/2505.16264].
- Gu, G.; Ko, B.; Go, S.; Lee, S.H.; Lee, J.; Shin, M. Towards Light-weight and Real-time Line Segment Detection. In Proceedings of the AAAI Conf. on Artificial Intelligence, 2022. M-LSD / M-LSD-tiny; MobileNetV2, center+displacement. arXiv:2106.00186.
- Hu, S.; Zhao, L.; Wang, Q. EM-LSD: A lightweight and efficient model for multi-scale line segment detection. Robotics and Autonomous Systems 2026, 195, 105192. https://doi.org/10.1016/j.robot.2025.105192. [CrossRef]
- STMicroelectronics. STM32N6 Series: Arm Cortex-M55 Microcontrollers with Neural-ART Accelerator. https://www.st.com/en/microcontrollers-microprocessors/stm32n6-series.html, 2025. Neural-ART neural processing unit; on-chip SRAM ∼4.2 MB; external xSPI flash and hyperRAM.
- STMicroelectronics. ST Neural-ART Accelerator: Introduction. https://www.st.com/resource/en/product_presentation/st-neural-art-accelerator-introduction.pdf, 2025. Convolution-oriented NPU; epoch-controller execution model.
- STMicroelectronics. ST Edge AI Suite / X-CUBE-AI / ST Edge AI Developer Cloud. https://www.st.com/en/embedded-software/x-cube-ai.html, 2025. Model analysis, int8 code generation, and on-target benchmarking for STM32.
- Jalilvand, A.H.; Panahi, P.H.S.; Najafi, M.H. A Low-Latency ASIC Architecture for Real-Time Line Segment Detection, 2026, [arXiv:cs.AR/2608.06439].
- Peng, Y.; et al. D-FINE: Redefine Regression Task in DETRs as Fine-grained Distribution Refinement. arXiv:2410.13842, 2024. Source of the HGNetv2-B0 backbone used by LINEA and adapted here.
- Zhao, Y.; Lv, W.; Xu, S.; Wei, J.; Wang, G.; Dang, Q.; Liu, Y.; Chen, J. DETRs Beat YOLOs on Real-time Object Detection. In Proceedings of the IEEE/CVF Conf. on Computer Vision and Pattern Recognition (CVPR), 2024. RT-DETR. arXiv:2304.08069.
- Jacob, B.; Kligys, S.; Chen, B.; Zhu, M.; Tang, M.; Howard, A.; Adam, H.; Kalenichenko, D. Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference. In Proceedings of the IEEE/CVF Conf. on Computer Vision and Pattern Recognition (CVPR), 2018. arXiv:1712.05877.
- Hassani Shariat Panahi, P. LI-NPU: Training and Deployment Notebook. https://www.kaggle.com/code/parsahshariatpanahi/linpu, 2026. Kaggle notebook: Model, training, structural-AP evaluation, and ONNX export.
- Hassani Shariat Panahi, P. NPLSD-H warm-start training and evaluation notebook. https://www.kaggle.com/code/parsahshariatpanahi/linpu-warm, 2026. Kaggle notebook; reproduces the warm-started accuracy figures of this paper.
- Hassani Shariat Panahi, P. NPLSD-M training notebook: An accelerator-compatible adaptation of the M-LSD trunk. https://www.kaggle.com/code/parsahshariatpanahi/mlsd-n6-compatible, 2026. Kaggle notebook; identical head, loss, and recipe as NPLSD-H.
- Hassani Shariat Panahi, P. LSD-DST: Wireframe training data and ImageNet-pretrained trunk weights. https://www.kaggle.com/datasets/parsahshariatpanahi/lsd-dst, 2026. Dataset; includes hgnetv2_b0_stage1 and mobilenetv2_imagenet_enc warm-start checkpoints.
- Tumialis, P.; Skierkowski, M.; Przychodny, J.; Obszarski, P. The Impact of 8- and 4-Bit Quantization on the Accuracy and Silicon Area Footprint of Tiny Neural Networks. Electronics 2025, 14, 14. DOI:10.3390/electronics14010014; closest methodological twin (8- vs 4-bit, KD+QAT). [CrossRef]
- Hassani Shariat Panahi, P.; Jalilvand, A.H.; Najafi, M.H. MiLSD: Micro Line-Segment Detector. arXiv:2607.06600, 2026. Companion work; same center/length/angle representation on a no-NPU Cortex-M7.
- Huang, S.; Qin, F.; Xiong, P.; Ding, N.; He, Y.; Liu, X. TP-LSD: Tri-Points Based Line Segment Detector. In Proceedings of the European Conf. on Computer Vision (ECCV), 2020. arXiv:2009.05505.
- Mirzadeh, S.I.; Farajtabar, M.; Li, A.; Levine, N.; Matsukawa, A.; Ghasemzadeh, H. Improved Knowledge Distillation via Teacher Assistant. In Proceedings of the AAAI Conf. on Artificial Intelligence, 2020. capacity-gap effect.
Figure 2.
Qualitative NPLSD detections on ShanghaiTech Wireframe. Top: ground-truth. Middle: NPLSD-H. Bottom: NPLSD-M, predictions colored by confidence. Both models capture dominant structural lines while missing finer detail, with NPLSD-M recovering more of the long edges.
Figure 2.
Qualitative NPLSD detections on ShanghaiTech Wireframe. Top: ground-truth. Middle: NPLSD-H. Bottom: NPLSD-M, predictions colored by confidence. Both models capture dominant structural lines while missing finer detail, with NPLSD-M recovering more of the long edges.

Figure 3.
Precision-recall curves at the matching threshold over the full validation split: NPLSD-H fp32/int8 (solid/dashed, ) and NPLSD-M fp32/int8 (). Real-calibration quantization shifts each curve only marginally; the int8 models are, for accuracy purposes, the same as their fp32 references.
Figure 3.
Precision-recall curves at the matching threshold over the full validation split: NPLSD-H fp32/int8 (solid/dashed, ) and NPLSD-M fp32/int8 (). Real-calibration quantization shifts each curve only marginally; the int8 models are, for accuracy purposes, the same as their fp32 references.

Figure 4.
Output of the six-channel dense head for validation image #170 (NPLSD-H top, NPLSD-M bottom). From left: input; raw center likelihood; half-length and double-angle orientation , both masked to the cells the decoder reads (center confidence above 0.15); segments reconstructed by the arithmetic decode, colored by confidence.
Figure 4.
Output of the six-channel dense head for validation image #170 (NPLSD-H top, NPLSD-M bottom). From left: input; raw center likelihood; half-length and double-angle orientation , both masked to the cells the decoder reads (center confidence above 0.15); segments reconstructed by the arithmetic decode, colored by confidence.

Figure 5.
Parameter count and weight footprint comparison. Left: NPLSD-H has 2.63M parameters, smaller than LINEA-N’s 3.9M, and NPLSD-M only 0.62M. Right: int8 quantization reduces NPLSD-H’s weight footprint from 10.05 MB to 2.55 MB (NPLSD-M: 0.65 MB), a microcontroller-class storage budget.
Figure 5.
Parameter count and weight footprint comparison. Left: NPLSD-H has 2.63M parameters, smaller than LINEA-N’s 3.9M, and NPLSD-M only 0.62M. Right: int8 quantization reduces NPLSD-H’s weight footprint from 10.05 MB to 2.55 MB (NPLSD-M: 0.65 MB), a microcontroller-class storage budget.

Table 1.
LINEA-N operator mapping on the STM32N6. NPU denotes the Neural-ART accelerator; CPU denotes the Cortex-M55 fallback.
Table 1.
LINEA-N operator mapping on the STM32N6. NPU denotes the Neural-ART accelerator; CPU denotes the Cortex-M55 fallback.
| Block / operator | Target |
|---|---|
| HGNetv2-B0 backbone (Conv, BN, ReLU, Pool) | NPU |
| Encoder CNN fusion (Conv, Resize-nearest, Concat) | NPU |
| Linear/Gemm projections (q/k/v, FFN) | NPU |
| Attention Softmax | CPU |
| LayerNorm | CPU |
| GridSample (line-attention sampling) | CPU |
| TopK + Gather (query selection) | CPU |
| Decoder self-attention () | cannot place |
Table 2.
Structural AP on the full Wireframe validation split (462 images). The int8 models are quantized with 200 real calibration images and are the configurations intended for the Neural-ART NPU (executed in ONNX Runtime). The from-scratch rows hold the NPLSD-H architecture fixed and vary only the initialization.
Table 2.
Structural AP on the full Wireframe validation split (462 images). The int8 models are quantized with 200 real calibration images and are the configurations intended for the Neural-ART NPU (executed in ONNX Runtime). The from-scratch rows hold the NPLSD-H architecture fixed and vary only the initialization.
| Configuration | |||
|---|---|---|---|
| NPLSD-H fp32, from scratch | 24.1 | 33.3 | 38.2 |
| NPLSD-H int8, from scratch | 23.2 | 32.0 | 36.3 |
| NPLSD-H fp32, warm | 28.5 | 37.9 | 42.3 |
| NPLSD-H int8, warm | 26.8 | 35.9 | 40.3 |
| NPLSD-M fp32, warm | 32.7 | 41.9 | 46.1 |
| NPLSD-M int8, warm | 32.2 | 41.1 | 45.1 |
Table 3.
Wireframe comparison across hardware classes. GPU and mobile results are from the M-LSD study [11] and the original papers (512-pixel inputs). Microcontroller entries are from this work and MiLSD [25].
| Method | Params | Platform | |
|---|---|---|---|
| LSD [1] | 8.8 | — | desktop CPU |
| TP-LSD-Lite [26] | 59.7 | 23.9M | GPU |
| L-CNN [3] | 62.8 | 9.8M | GPU |
| LINEA-N [10] | 65.0 | 3.9M | GPU |
| HAWP [4] | 66.5 | 10.4M | GPU |
| M-LSD-tiny [11] | 58.0 | 0.6M | mobile SoC |
| F-Clip-25k | 10.6 | 0.025M | MCU (M7) |
| MiLSD [25] | 24.1 | 0.39M | MCU (M7) |
| NPLSD-H int8 (ours) | 35.9 | 2.63M | MCU (M55+NPU) |
| NPLSD-M int8 (ours) | 41.1 | 0.62M | MCU (M55+NPU) |
Table 4.
Zero-shot structural AP on YorkUrban (102 images; trained on Wireframe only, no fine-tuning).
Table 4.
Zero-shot structural AP on YorkUrban (102 images; trained on Wireframe only, no fine-tuning).
| Configuration | |||
|---|---|---|---|
| NPLSD-H fp32 | 9.6 | 13.7 | 16.0 |
| NPLSD-H int8 | 8.5 | 12.5 | 14.5 |
| NPLSD-M fp32 | 13.0 | 17.2 | 19.6 |
| NPLSD-M int8 | 13.0 | 16.9 | 19.2 |
Table 5.
Recall by ground-truth segment length (fp32, confidence above 0.15, matching distance; lengths in label space). Warm-starting improves long-segment recall most; NPLSD-M leads across all buckets. The reduced recall on long segments is consistent with MiLSD [25], which uses the same center-based encoding.
Table 5.
Recall by ground-truth segment length (fp32, confidence above 0.15, matching distance; lengths in label space). Warm-starting improves long-segment recall most; NPLSD-M leads across all buckets. The reduced recall on long segments is consistent with MiLSD [25], which uses the same center-based encoding.
| GT length | # GT | H scratch | H warm | M warm |
|---|---|---|---|---|
| short () | 11,997 | 55.1% | 54.0% | 61.0% |
| medium (10–25) | 12,195 | 58.5% | 62.2% | 65.5% |
| long () | 10,094 | 38.1% | 44.0% | 48.0% |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.