class_docstr: Module extracting line segments from junctions and line heatmaps.
  
  Args:
      detect_thresh: The probability threshold for mean activation (0. ~ 1.)
      num_samples: Number of sampling locations along the line segments.
      inlier_thresh: The min inlier ratio to satisfy (0. ~ 1.) => 0. means no threshold.
      heatmap_low_thresh: The lowest threshold for the pixel to be considered as candidate in junction recovery.
      heatmap_high_thresh: The higher threshold for NMS in junction recovery.
      max_local_patch_radius: The max patch to be considered in local maximum search.
      lambda_radius: The lambda factor in linear local maximum search formulation
      use_candidate_suppression: Apply candidate suppression to break long segments into short sub-segments.
      nms_dist_tolerance: The distance tolerance for nms. Decide whether the junctions are on the line.
      use_heatmap_refinement: Use heatmap refinement method or not.
      heatmap_refine_cfg: The configs for heatmap refinement methods.
      use_junction_refinement: Use junction refinement method or not.
      junction_refine_cfg: The configs for junction refinement methods.
code: def __init__(
      self,
      detect_thresh: float,
      num_samples: int = 64,
      inlier_thresh: float = 0.0,
      heatmap_low_thresh: float = 0.15,
      heatmap_high_thresh: float = 0.2,
      max_local_patch_radius: float = 3,
      lambda_radius: float = 2.0,
      use_candidate_suppression: bool = False,
      nms_dist_tolerance: float = 3.0,
      use_heatmap_refinement: bool = False,
      heatmap_refine_cfg: Optional[Dict[str, Any]] = None,
      use_junction_refinement: bool = False,
      junction_refine_cfg: Optional[Dict[str, Any]] = None,
  ) -> None:
      # Line detection parameters
      self.detect_thresh = detect_thresh
  
      # Line sampling parameters
      self.num_samples = num_samples
      self.inlier_thresh = inlier_thresh
      self.local_patch_radius = max_local_patch_radius
      self.lambda_radius = lambda_radius
  
      # Detecting junctions on the boundary parameters
      self.low_thresh = heatmap_low_thresh
      self.high_thresh = heatmap_high_thresh
  
      # Pre-compute the linspace sampler
      self.torch_sampler = torch.linspace(0, 1, self.num_samples)
  
      # Long line segment suppression configuration
      self.use_candidate_suppression = use_candidate_suppression
      self.nms_dist_tolerance = nms_dist_tolerance
  
      # Heatmap refinement configuration
      self.use_heatmap_refinement = use_heatmap_refinement
      self.heatmap_refine_cfg = heatmap_refine_cfg
      if (
          self.use_heatmap_refinement
          and self.heatmap_refine_cfg is None
      ):
          raise ValueError("[Error] Missing heatmap refinement config.")
  
      # Junction refinement configuration
      self.use_junction_refinement = use_junction_refinement
      self.junction_refine_cfg = junction_refine_cfg
      if (
          self.use_junction_refinement
          and self.junction_refine_cfg is None
      ):
          raise ValueError(
              "[Error] Missing junction refinement config."
          )
  
imports: import math
  from typing import Any, Dict, Optional, Tuple
  import torch
  from kornia.core import Module, Tensor, concatenate, sin, stack, tensor, where, zeros
  from kornia.core.check import KORNIA_CHECK_SHAPE
  from kornia.geometry.bbox import nms
  from kornia.utils import map_location_to_cpu, torch_meshgrid
  from .backbones import SOLD2Net
label_desc: Use image node_id 1 to create a new LineSegmentDetectionModule object  with example: obj = LineSegmentDetectionModule(detect_thresh, num_samples, inlier_thresh, heatmap_low_thresh, heatmap_high_thresh, max_local_patch_radius, lambda_radius, use_candidate_suppression, nms_dist_tolerance, use_heatmap_refinement, heatmap_refine_cfg, use_junction_refinement, junction_refine_cfg)