class_docstr: DatasetBuilder for controlled_noisy_web_labels dataset.
class_docstr_tok: ["DatasetBuilder","for","controlled_noisy_web_labels","dataset","."]
docstr: Returns SplitGenerators.
docstr_tok: ["Returns","SplitGenerators","."]
code: def _split_generators(
      self, dl_manager: tfds.download.DownloadManager
  ):
      """Returns SplitGenerators."""
      imnet_path = os.path.join(
          dl_manager.manual_dir, "ILSVRC2012_img_train.tar"
      )
      noisy_images_path = os.path.join(
          dl_manager.manual_dir, "noisy_images"
      )
      noisy_split_path = os.path.join(
          dl_manager.manual_dir,
          "dataset_no_images",
          "mini-imagenet",
          "split",
      )
      noisy_annot_path = os.path.join(
          dl_manager.manual_dir,
          "dataset_no_images",
          "mini-imagenet-annotations.json",
      )
      val_path = os.path.join(
          dl_manager.manual_dir, "ILSVRC2012_img_val.tar"
      )
  
      with epath.Path(noisy_annot_path).open() as json_file:
          data = json.load(json_file)
  
      image_data = data["data"]
      noisy_image_ids = [
          elem[0]["image/id"] + ".jpg" for elem in image_data
      ]
  
      # We first load all mini-ImageNet images in the memory, and
      # will access them for the other splits
      paths = dl_manager.download(
          {
              "mini_train": MINI_IMAGENET_TRAIN,
              "mini_val": MINI_IMAGENET_VAL,
              "mini_test": MINI_IMAGENET_TEST,
          }
      )
  
      train_fnames = self._read_mini_imagenet_csv(paths["mini_train"])
      val_fnames = self._read_mini_imagenet_csv(paths["mini_val"])
      test_fnames = self._read_mini_imagenet_csv(paths["mini_test"])
      mini_imnet_fnames = train_fnames + val_fnames + test_fnames
  
      mini_imnet_images = self._get_clean_images(
          mini_imnet_fnames, dl_manager.iter_archive(imnet_path)
      )
  
      val_split_file = os.path.join(
          noisy_split_path, "clean_validation"
      )
  
      split_to_generator = {}
  
      split_to_generator[
          tfds.Split.VALIDATION
      ] = self._generate_val_examples(
          val_split_file, dl_manager.iter_archive(val_path)
      )
  
      for percent in _PERCENTS:
          split_name = tfds.Split.TRAIN + "_" + "{:02d}".format(percent)
          split_file = os.path.join(
              noisy_split_path,
              "{}_noise_nl_{}".format(
                  self.builder_config.color, str(percent / 100)
              ),
          )
          split_to_generator[split_name] = self._generate_examples(
              split_file,
              noisy_image_ids,
              noisy_images_path,
              mini_imnet_images,
          )
  
      return split_to_generator
  
file_path: datasets/tensorflow_datasets/image_classification/controlled_noisy_web_labels/controlled_noisy_web_labels.py
imports: import csv
  import dataclasses
  import io
  import json
  import os
  from etils import epath
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 5 for calling the ControlledNoisyWebLabels obj's underlying member method code with example usage: obj._split_generators(dl_manager) and returns: split_to_generator