code: def sample_lane(points, sample_ys, img_w):
      # this function expects the points to be sorted
      points = np.array(points)
      if not np.all(points[1:, 1] < points[:-1, 1]):
          raise Exception("Annotaion points have to be sorted")
      x, y = points[:, 0], points[:, 1]
  
      # interpolate points inside domain
      assert len(points) > 1
      interp = InterpolatedUnivariateSpline(
          y[::-1], x[::-1], k=min(3, len(points) - 1)
      )
      domain_min_y = y.min()
      domain_max_y = y.max()
      sample_ys_inside_domain = sample_ys[
          (sample_ys >= domain_min_y) & (sample_ys <= domain_max_y)
      ]
      assert len(sample_ys_inside_domain) > 0
      interp_xs = interp(sample_ys_inside_domain)
  
      # extrapolate lane to the bottom of the image with a straight line using the 2 points closest to the bottom
      two_closest_points = points[:2]
      extrap = np.polyfit(
          two_closest_points[:, 1], two_closest_points[:, 0], deg=1
      )
      extrap_ys = sample_ys[sample_ys > domain_max_y]
      extrap_xs = np.polyval(extrap, extrap_ys)
      all_xs = np.hstack((extrap_xs, interp_xs))
  
      # separate between inside and outside points
      inside_mask = (all_xs >= 0) & (all_xs < img_w)
      xs_inside_image = all_xs[inside_mask]
      xs_outside_image = all_xs[~inside_mask]
  
      return xs_outside_image, xs_inside_image
  
file_path: PaddleDetection/ppdet/data/culane_utils.py
imports: import math
  import numpy
  from imgaug.augmentables.lines import LineString
  from scipy.interpolate import InterpolatedUnivariateSpline
label_desc: Use image node_id 3 for calling a global function with example usage: sample_lane(points, sample_ys, img_w) and returns: xs_outside_image,  xs_inside_image