class_docstr: Sample frames id.
  NOTE: Use PIL to read image here, has diff with CV2
  Args:
      num_seg(int): number of segments.
      seg_len(int): number of sampled frames in each segment.
      valid_mode(bool): True or False.
  Returns:
      frames_idx: the index of sampled #frames.
code: def _get(self, frames_idx, results):
      data_format = results["format"]
  
      if data_format == "frame":
          frame_dir = results["frame_dir"]
          imgs = []
          for idx in frames_idx:
              img = Image.open(
                  os.path.join(frame_dir, results["suffix"].format(idx))
              ).convert("RGB")
              imgs.append(img)
  
      elif data_format == "video":
          if results["backend"] == "cv2":
              frames = np.array(results["frames"])
              imgs = []
              for idx in frames_idx:
                  imgbuf = frames[idx]
                  img = Image.fromarray(imgbuf, mode="RGB")
                  imgs.append(img)
          elif results["backend"] == "decord":
              container = results["frames"]
              if self.use_pil:
                  frames_select = container.get_batch(frames_idx)
                  # dearray_to_img
                  np_frames = frames_select.asnumpy()
                  imgs = []
                  for i in range(np_frames.shape[0]):
                      imgbuf = np_frames[i]
                      imgs.append(Image.fromarray(imgbuf, mode="RGB"))
              else:
                  if frames_idx.ndim != 1:
                      frames_idx = np.squeeze(frames_idx)
                  frame_dict = {
                      idx: container[idx].asnumpy()
                      for idx in np.unique(frames_idx)
                  }
                  imgs = [frame_dict[idx] for idx in frames_idx]
          elif results["backend"] == "pyav":
              imgs = []
              frames = np.array(results["frames"])
              for idx in frames_idx:
                  imgbuf = frames[idx]
                  imgs.append(imgbuf)
              imgs = np.stack(imgs)  # thwc
          else:
              raise NotImplementedError
      else:
          raise NotImplementedError
      results["imgs"] = imgs  # all image data
      return results
  
imports: import cv2
  import numpy
  from PIL import Image
  import paddle
label_desc: Use image node_id 2 for calling the Sampler obj's underlying member method code with example usage: obj._get(frames_idx, results) and returns: results