class_docstr: Module, which detects line segments in an image.
  
  This is based on the original code from the paper "SOLD²: Self-supervised
  Occlusion-aware Line Detector and Descriptor". See :cite:`SOLD22021` for more details.
  
  Args:
      config: Dict specifying parameters. None will load the default parameters,
          which are tuned for images in the range 400~800 px.
      pretrained: If True, download and set pretrained weights to the model.
  
  Returns:
      The raw junction and line heatmaps, as well as the list of detected line segments (ij coordinates convention).
  
  Example:
      >>> img = torch.rand(1, 1, 512, 512)
      >>> sold2_detector = SOLD2_detector()
      >>> line_segments = sold2_detector(img)["line_segments"]
code: def adapt_state_dict(
      self, state_dict: Dict[str, Any]
  ) -> Dict[str, Any]:
      del state_dict["w_junc"]
      del state_dict["w_heatmap"]
      del state_dict["w_desc"]
      state_dict[
          "heatmap_decoder.conv_block_lst.2.0.weight"
      ] = state_dict["heatmap_decoder.conv_block_lst.2.weight"]
      state_dict[
          "heatmap_decoder.conv_block_lst.2.0.bias"
      ] = state_dict["heatmap_decoder.conv_block_lst.2.bias"]
      del state_dict["heatmap_decoder.conv_block_lst.2.weight"]
      del state_dict["heatmap_decoder.conv_block_lst.2.bias"]
      return state_dict
  
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 2 for calling the SOLD2_detector obj's underlying member method code with example usage: obj.adapt_state_dict(state_dict) and returns: state_dict