code: def __init__(self, dataset, samples_per_gpu=1):
      assert hasattr(dataset, "flag")
      self.dataset = dataset
      self.samples_per_gpu = samples_per_gpu
      self.flag = dataset.flag.astype(np.int64)
      self.group_sizes = np.bincount(self.flag)
      self.num_samples = 0
      for i, size in enumerate(self.group_sizes):
          self.num_samples += (
              int(np.ceil(size / self.samples_per_gpu))
              * self.samples_per_gpu
          )
  
file_path: insightface/detection/scrfd/mmdet/datasets/samplers/group_sampler.py
imports: from __future__ import division
  import math
  import numpy
  import torch
  from mmcv.runner import get_dist_info
  from torch.utils.data import Sampler
label_desc: Use image node_id 1 to create a new GroupSampler object from inherited base classes: Sampler with example: obj = GroupSampler(dataset, samples_per_gpu)