class_docstr: DatasetBuilder for controlled_noisy_web_labels dataset.
class_docstr_tok: ["DatasetBuilder","for","controlled_noisy_web_labels","dataset","."]
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(
      self, split_file, noisy_image_ids, noisy_images_path, clean_images
  ):
      """Yields examples."""
  
      with epath.Path(split_file).open() as fp:
          split_info = fp.read().splitlines()
  
      split_names, split_labels = map(
          list, zip(*[elem.split(" ") for elem in split_info])
      )
  
      # We use a set here because searching in a set is faster than a list
      noisy_image_ids = set(noisy_image_ids)
  
      for imname, label in zip(split_names, split_labels):
          example = {}
          if imname in noisy_image_ids:
              # If the image comes from noise image list, it's not clean
              example["is_clean"] = 0
              with tf.io.gfile.GFile(
                  os.path.join(noisy_images_path, imname), "rb"
              ) as f:
                  example["image"] = self._resize_image(f.read())
          else:
              example["image"] = clean_images[imname][0]
              # Check if the assigned label and the real label is the same
              if clean_images[imname][1] == int(label):
                  example["is_clean"] = 1
              else:
                  example["is_clean"] = 0
  
          example["label"] = int(label)
          example["id"] = imname[:-4]
          yield imname[:-4], example
  
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 7 for calling the ControlledNoisyWebLabels obj's underlying member method code with example usage: obj._generate_examples(split_file, noisy_image_ids, noisy_images_path, clean_images) without return types