class_docstr: Sampler that providing image-level sampling outputs for video datasets
  in tracking tasks. It could be both used in both distributed and
  non-distributed environment.
  If using the default sampler in pytorch, the subsequent data receiver will
  get one video, which is not desired in some cases:
  (Take a non-distributed environment as an example)
  1. In test mode, we want only one image is fed into the data pipeline. This
  is in consideration of memory usage since feeding the whole video commonly
  requires a large amount of memory (>=20G on MOTChallenge17 dataset), which
  is not available in some machines.
  2. In training mode, we may want to make sure all the images in one video
  are randomly sampled once in one epoch and this can not be guaranteed in
  the default sampler in pytorch.
  
  Args:
      dataset (Sized): Dataset used for sampling.
      seed (int, optional): random seed used to shuffle the sampler. This
          number should be identical across all processes in the distributed
          group. Defaults to None.
class_docstr_tok: ["Sampler","that","providing","image-level","sampling","outputs","for","video","datasets","in","tracking","tasks",".","It","could","be","both","used","in","both","distributed","and","non-distributed","environment",".","If","using","the","default","sampler","in","pytorch",",","the","subsequent","data","receiver","will","get","one","video",",","which","is","not","desired","in","some","cases",":","(","Take","a","non-distributed","environment","as","an","example",")","1",".","In","test","mode",",","we","want","only","one","image","is","fed","into","the","data","pipeline",".","This","is","in","consideration","of","memory","usage","since","feeding","the","whole","video","commonly","requires","a","large","amount","of","memory","(",">","=20G","on","MOTChallenge17","dataset",")",",","which","is","not","available","in","some","machines",".","2",".","In","training","mode",",","we","may","want","to","make","sure","all","the","images","in","one","video","are","randomly","sampled","once","in","one","epoch","and","this","can","not","be","guaranteed","in","the","default","sampler","in","pytorch",".","Args",":","dataset","(","Sized",")",":","Dataset","used","for","sampling",".","seed","(","int",",","optional",")",":","random","seed","used","to","shuffle","the","sampler",".","This","number","should","be","identical","across","all","processes","in","the","distributed","group",".","Defaults","to","None","."]
code: def set_epoch(self, epoch):
      self.epoch = epoch
  
file_path: mmdetection/mmdet/datasets/samplers/track_img_sampler.py
imports: import math
  import random
  from typing import Iterator, Optional, Sized
  import numpy
  from mmengine.dataset import ClassBalancedDataset, ConcatDataset
  from mmengine.dist import get_dist_info, sync_random_seed
  from torch.utils.data import Sampler
  from mmdet.registry import DATA_SAMPLERS
  from ..base_video_dataset import BaseVideoDataset
label_desc: Use image node_id 4 for calling the TrackImgSampler obj's underlying member method code with example usage: obj.set_epoch(epoch) without return types