code: def interpolate_landmarks(self, landmarks):
      valid_frames_idx = [
          idx for idx, lm in enumerate(landmarks) if lm is not None
      ]
  
      if not valid_frames_idx:
          return None
  
      for idx in range(1, len(valid_frames_idx)):
          if valid_frames_idx[idx] - valid_frames_idx[idx - 1] > 1:
              landmarks = linear_interpolate(
                  landmarks,
                  valid_frames_idx[idx - 1],
                  valid_frames_idx[idx],
              )
  
      valid_frames_idx = [
          idx for idx, lm in enumerate(landmarks) if lm is not None
      ]
  
      # Handle corner case: keep frames at the beginning or at the end that failed to be detected
      if valid_frames_idx:
          landmarks[: valid_frames_idx[0]] = [
              landmarks[valid_frames_idx[0]]
          ] * valid_frames_idx[0]
          landmarks[valid_frames_idx[-1] :] = [
              landmarks[valid_frames_idx[-1]]
          ] * (len(landmarks) - valid_frames_idx[-1])
  
      assert all(
          lm is not None for lm in landmarks
      ), "not every frame has landmark"
  
      return landmarks
  
file_path: audio/examples/avsr/data_prep/detectors/mediapipe/video_process.py
imports: import cv2
  import numpy
  from skimage import transform
label_desc: Use image node_id 4 for calling the VideoProcess obj's underlying member method code with example usage: obj.interpolate_landmarks(landmarks) and returns: landmarks, None