class_docstr: Class balanced subset of Imagenet 2012 dataset for few-shot learning.
code: def _split_generators(self, dl_manager):
      train_path = os.path.join(
          dl_manager.manual_dir, "ILSVRC2012_img_train.tar"
      )
      val_path = os.path.join(
          dl_manager.manual_dir, "ILSVRC2012_img_val.tar"
      )
  
      if not tf.io.gfile.exists(train_path) or not tf.io.gfile.exists(
          val_path
      ):
          raise AssertionError(
              "ImageNet requires manual download of the data. Please download "
              "the train and val set and place them into: {}, {}".format(
                  train_path, val_path
              )
          )
  
      # Download and load subset file.
      subset_file = SUBSET2FILES[self.builder_config.name]
      if isinstance(
          subset_file, list
      ):  # it will only be a list during testing,
          subset_file = subset_file[
              0
          ]  # where the first entry is 1shot.txt.
      subset = set(subset_file.read_text().splitlines())
  
      # Get the file for tune split.
      tuneset = set(TUNE_FILE.read_text().splitlines())
  
      return {
          tfds.Split.TRAIN: self._generate_examples(
              archive=dl_manager.iter_archive(train_path), subset=subset
          ),
          tfds.Split("tune"): self._generate_examples(
              archive=dl_manager.iter_archive(train_path),
              subset=tuneset,
          ),
          tfds.Split.VALIDATION: self._generate_examples(
              archive=dl_manager.iter_archive(val_path),
              validation_labels=imagenet_common.get_validation_labels(
                  val_path
              ),
          ),
      }
  
file_path: datasets/tensorflow_datasets/datasets/imagenet2012_fewshot/imagenet2012_fewshot_dataset_builder.py
imports: import os
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  from tensorflow_datasets.datasets.imagenet2012 import imagenet_common
  from tensorflow_datasets.datasets.imagenet2012_subset import imagenet2012_subset_dataset_builder
  import tensorflow_datasets.public_api
label_desc: Use image node_id 2 for calling the Builder obj's underlying member method code with example usage: obj._split_generators(dl_manager) and returns: dict