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.
class_docstr_tok: ["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 __init__(
      self,
      num_seg,
      seg_len,
      frame_interval=None,
      valid_mode=True,
      dense_sample=False,
      linspace_sample=False,
      use_pil=True,
  ):
      self.num_seg = num_seg
      self.seg_len = seg_len
      self.frame_interval = frame_interval
      self.valid_mode = valid_mode
      self.dense_sample = dense_sample
      self.linspace_sample = linspace_sample
      self.use_pil = use_pil
  
imports: import cv2
  import numpy
  from PIL import Image
  import paddle
label_desc: Use image node_id 1 to create a new Sampler object from inherited base classes: object with example: obj = Sampler(num_seg, seg_len, frame_interval, valid_mode, dense_sample, linspace_sample, use_pil)