docstr: NMS for lane detection.
  predictions: paddle.Tensor [num_lanes,conf,y,x,lenght,72offsets] [12,77]
  scores: paddle.Tensor [num_lanes]
  nms_overlap_thresh: float
  top_k: int
docstr_tok: ["NMS","for","lane","detection",".","predictions",":","paddle.Tensor","[","num_lanes",",","conf",",","y",",","x",",","lenght,72offsets","]","[","12,77","]","scores",":","paddle.Tensor","[","num_lanes","]","nms_overlap_thresh",":","float","top_k",":","int"]
code: def lane_nms(self, predictions, scores, nms_overlap_thresh, top_k):
      """
      NMS for lane detection.
      predictions: paddle.Tensor [num_lanes,conf,y,x,lenght,72offsets] [12,77]
      scores: paddle.Tensor [num_lanes]
      nms_overlap_thresh: float
      top_k: int
      """
      # sort by scores to get idx
      idx = scores.argsort(descending=True)
      keep = []
  
      condidates = predictions.clone()
      condidates = condidates.index_select(idx)
  
      while len(condidates) > 0:
          keep.append(idx[0])
          if len(keep) >= top_k or len(condidates) == 1:
              break
  
          ious = []
          for i in range(1, len(condidates)):
              ious.append(
                  1
                  - line_iou(
                      condidates[i].unsqueeze(0),
                      condidates[0].unsqueeze(0),
                      img_w=self.img_w,
                      length=15,
                  )
              )
          ious = paddle.to_tensor(ious)
  
          mask = ious <= nms_overlap_thresh
          id = paddle.where(mask == False)[0]
  
          if id.shape[0] == 0:
              break
          condidates = condidates[1:].index_select(id)
          idx = idx[1:].index_select(id)
      keep = paddle.stack(keep)
  
      return keep
  
imports: import math
  import paddle
  import numpy
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register
  from ppdet.modeling.initializer import normal_
  from ppdet.modeling.lane_utils import Lane
  from ppdet.modeling.losses import line_iou
  from ppdet.modeling.clrnet_utils import ROIGather, LinearModule, SegDecoder
label_desc: Use image node_id 8 for calling the CLRHead obj's underlying member method code with example usage: obj.lane_nms(predictions, scores, nms_overlap_thresh, top_k) and returns: keep