code: def init_fence_line(
      self, lanes, pos_dir_traj, neg_dir_traj, frame_shape
  ):
      fence_lines_candidate = None
      h, w, _ = frame_shape
      abs_distance = h * h + w * w
  
      for lane in lanes[0]:
          pos_dir_distansce = h * h + w * w
          neg_dir_distansce = h * h + w * w
          pos_dir = 0
          neg_dir = 0
  
          for traj_line in pos_dir_traj:
              dir_result, distansce = self.driving_direction(
                  lane, traj_line["traj_line"]
              )
              if dir_result > 0:
                  pos_dir_distansce = (
                      distansce
                      if distansce < pos_dir_distansce
                      else pos_dir_distansce
                  )
                  pos_dir = 1
              else:
                  neg_dir_distansce = (
                      distansce
                      if distansce < neg_dir_distansce
                      else neg_dir_distansce
                  )
                  neg_dir = 1
  
          if pos_dir > 0 and neg_dir > 0:
              continue
  
          for traj_line in neg_dir_traj:
              dir_result, distansce = self.driving_direction(
                  lane, traj_line["traj_line"]
              )
  
              if dir_result > 0:
                  pos_dir_distansce = (
                      distansce
                      if distansce < pos_dir_distansce
                      else pos_dir_distansce
                  )
                  pos_dir = 1
              else:
                  neg_dir_distansce = (
                      distansce
                      if distansce < neg_dir_distansce
                      else neg_dir_distansce
                  )
                  neg_dir = 1
  
          if pos_dir > 0 and neg_dir > 0:
              diff_dir_distance = abs(
                  pos_dir_distansce - neg_dir_distansce
              )
              if diff_dir_distance < abs_distance:
                  fence_lines_candidate = lane
                  abs_distance = diff_dir_distance
  
      if fence_lines_candidate is None:
          return None
  
      fence_lines_candidate = self.get_long_fence_line(
          h, w, fence_lines_candidate
      )
  
      return fence_lines_candidate
  
file_path: PaddleDetection/deploy/pipeline/ppvehicle/vehicle_retrograde.py
imports: import numpy
  import math
label_desc: Use image node_id 8 for calling the VehicleRetrogradeRecognizer obj's underlying member method code with example usage: obj.init_fence_line(lanes, pos_dir_traj, neg_dir_traj, frame_shape) and returns: fence_lines_candidate, None