class_docstr: Uniformly sample reference frames.
  
  Args:
      num_ref_imgs (int): Number of reference frames to be sampled.
      frame_range (int | list[int]): Range of frames to be sampled around
          key frame. If int, the range is [-frame_range, frame_range].
          Defaults to 10.
      filter_key_img (bool): Whether to filter the key frame when
          sampling reference frames. Defaults to True.
      collect_video_keys (list[str]): The keys of video info to be
          collected.
class_docstr_tok: ["Uniformly","sample","reference","frames",".","Args",":","num_ref_imgs","(","int",")",":","Number","of","reference","frames","to","be","sampled",".","frame_range","(","int","|","list","[","int","]",")",":","Range","of","frames","to","be","sampled","around","key","frame",".","If","int",",","the","range","is","[","-frame_range",",","frame_range","]",".","Defaults","to","10.","filter_key_img","(","bool",")",":","Whether","to","filter","the","key","frame","when","sampling","reference","frames",".","Defaults","to","True",".","collect_video_keys","(","list","[","str","]",")",":","The","keys","of","video","info","to","be","collected","."]
code: def __init__(
      self,
      num_ref_imgs: int = 1,
      frame_range: Union[int, List[int]] = 10,
      filter_key_img: bool = True,
      collect_video_keys: List[str] = ["video_id", "video_length"],
  ):
      self.num_ref_imgs = num_ref_imgs
      self.filter_key_img = filter_key_img
      if isinstance(frame_range, int):
          assert (
              frame_range >= 0
          ), "frame_range can not be a negative value."
          frame_range = [-frame_range, frame_range]
      elif isinstance(frame_range, list):
          assert len(frame_range) == 2, "The length must be 2."
          assert frame_range[0] <= 0 and frame_range[1] >= 0
          for i in frame_range:
              assert isinstance(i, int), "Each element must be int."
      else:
          raise TypeError(
              "The type of frame_range must be int or list."
          )
      self.frame_range = frame_range
      super().__init__(collect_video_keys=collect_video_keys)
  
file_path: mmdetection/mmdet/datasets/transforms/frame_sampling.py
imports: import random
  from collections import defaultdict
  from typing import Dict, List, Optional, Union
  from mmcv.transforms import BaseTransform
  from mmdet.registry import TRANSFORMS
label_desc: Use image node_id 1 to create a new UniformRefFrameSample object from inherited base classes: BaseFrameSample with example: obj = UniformRefFrameSample(num_ref_imgs, frame_range, filter_key_img, collect_video_keys)