class_docstr: Module, which detects and describe 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, the semi-dense descriptor map,
      as well as the list of detected line segments (ij coordinates convention).
  
  Example:
      >>> images = torch.rand(2, 1, 512, 512)
      >>> sold2 = SOLD2()
      >>> outputs = sold2(images)
      >>> line_seg1 = outputs["line_segments"][0]
      >>> line_seg2 = outputs["line_segments"][1]
      >>> desc1 = outputs["dense_desc"][0]
      >>> desc2 = outputs["dense_desc"][1]
      >>> matches = sold2.match(line_seg1, line_seg2, desc1[None], desc2[None])
class_docstr_tok: ["Module",",","which","detects","and","describe","line","segments","in","an","image",".","This","is","based","on","the","original","code","from","the","paper","``","SOLD\u00b2",":","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",",","the","semi-dense","descriptor","map",",","as","well","as","the","list","of","detected","line","segments","(","ij","coordinates","convention",")",".","Example",":",">",">",">","images","=","torch.rand","(","2",",","1",",","512",",","512",")",">",">",">","sold2","=","SOLD2","(",")",">",">",">","outputs","=","sold2","(","images",")",">",">",">","line_seg1","=","outputs","[","``","line_segments","''","]","[","0","]",">",">",">","line_seg2","=","outputs","[","``","line_segments","''","]","[","1","]",">",">",">","desc1","=","outputs","[","``","dense_desc","''","]","[","0","]",">",">",">","desc2","=","outputs","[","``","dense_desc","''","]","[","1","]",">",">",">","matches","=","sold2.match","(","line_seg1",",","line_seg2",",","desc1","[","None","]",",","desc2","[","None","]",")"]
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: from typing import Any, Dict, Optional, Tuple
  import torch
  import torch.nn.functional
  from kornia.core import Module, Tensor, concatenate, pad, stack
  from kornia.core.check import KORNIA_CHECK_SHAPE
  from kornia.geometry.conversions import normalize_pixel_coordinates
  from kornia.utils import map_location_to_cpu
  from .backbones import SOLD2Net
  from .sold2_detector import LineSegmentDetectionModule, line_map_to_segments, prob_to_junctions
label_desc: Use image node_id 4 for calling the SOLD2 obj's underlying member method code with example usage: obj.adapt_state_dict(state_dict) and returns: state_dict