class_docstr: Corrupted ImageNet2012 dataset.
class_docstr_tok: ["Corrupted","ImageNet2012","dataset","."]
docstr: Generate corrupted imagenet validation data.
  
  Apply corruptions to the raw images according to self.corruption_type.
  
  Args:
    archive: an iterator for the raw dataset.
    validation_labels: a dict that maps the file names to imagenet labels.
    labels_exist: unused, to comply with pytype, since overriden method has
      argument too.
  
  Yields:
    dictionary with the file name, an image file objective, and label of each
    imagenet validation data.
docstr_tok: ["Generate","corrupted","imagenet","validation","data",".","Apply","corruptions","to","the","raw","images","according","to","self.corruption_type",".","Args",":","archive",":","an","iterator","for","the","raw","dataset",".","validation_labels",":","a","dict","that","maps","the","file","names","to","imagenet","labels",".","labels_exist",":","unused",",","to","comply","with","pytype",",","since","overriden","method","has","argument","too",".","Yields",":","dictionary","with","the","file","name",",","an","image","file","objective",",","and","label","of","each","imagenet","validation","data","."]
code: def _generate_examples(
      self, archive, validation_labels=None, labels_exist=None
  ):
      """Generate corrupted imagenet validation data.
  
      Apply corruptions to the raw images according to self.corruption_type.
  
      Args:
        archive: an iterator for the raw dataset.
        validation_labels: a dict that maps the file names to imagenet labels.
        labels_exist: unused, to comply with pytype, since overriden method has
          argument too.
  
      Yields:
        dictionary with the file name, an image file objective, and label of each
        imagenet validation data.
      """
      del labels_exist
      # Get the current random seeds.
      numpy_st0 = np.random.get_state()
      # Set new random seeds.
      np.random.seed(135)
      logging.warning("Overwriting cv2 RNG seed.")
      tfds.core.lazy_imports.cv2.setRNGSeed(357)
  
      gen_fn = super(Builder, self)._generate_examples
      for key, example in gen_fn(archive, validation_labels):
          with tf.Graph().as_default():
              tf_img = _decode_and_center_crop(example["image"].read())
              image_np = tfds.as_numpy(tf_img)
          example["image"] = self._get_corrupted_example(image_np)
  
          yield key, example
      # Reset the seeds back to their original values.
      np.random.set_state(numpy_st0)
  
file_path: datasets/tensorflow_datasets/datasets/imagenet2012_corrupted/imagenet2012_corrupted_dataset_builder.py
imports: from absl import logging
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  from tensorflow_datasets.datasets.imagenet2012 import imagenet2012_dataset_builder
  from tensorflow_datasets.datasets.imagenet2012 import imagenet_common
  from tensorflow_datasets.image_classification import corruptions
  import tensorflow_datasets.public_api
label_desc: Use image node_id 3 for calling the Builder obj's underlying member method code with example usage: obj._generate_examples(archive, validation_labels, labels_exist) without return types