class_docstr: An ImageNet test set recollected by following the original protocol.
class_docstr_tok: ["An","ImageNet","test","set","recollected","by","following","the","original","protocol","."]
docstr: Yields the examples.
docstr_tok: ["Yields","the","examples","."]
code: def _generate_examples(self, imagenet_v2_root):
      """Yields the examples."""
      # The directory structure is `class_number/filename_number.jpg`, where
      # class_number is in [0, 1000) and filename_number in [0, 10).
      for class_id in tf.io.gfile.listdir(imagenet_v2_root):
          class_dir = os.path.join(imagenet_v2_root, class_id)
          for image_filename in tf.io.gfile.listdir(class_dir):
              image_path = os.path.join(class_dir, image_filename)
              features = {
                  "image": image_path,
                  "label": int(class_id),
                  "file_name": os.path.join(class_id, image_filename),
              }
              yield f"{class_id}_{image_filename}", features
  
file_path: datasets/tensorflow_datasets/datasets/imagenet_v2/imagenet_v2_dataset_builder.py
imports: import os
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  from tensorflow_datasets.datasets.imagenet2012 import imagenet_common
  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(imagenet_v2_root) without return types