class_docstr: DeepWeeds Image Dataset Class.
docstr: Generate images and labels for splits.
docstr_tok: ["Generate","images","and","labels","for","splits","."]
code: def _generate_examples(self, data_dir_path, label_path):
      """Generate images and labels for splits."""
  
      with epath.Path(label_path).open() as f:
          # Convert to list to reuse the iterator multiple times
          reader = list(csv.DictReader(f))
  
      # Extract the mapping int -> str and save the label name string to the
      # feature
      label_id_to_name = {
          int(row["Label"]): row["Species"] for row in reader
      }
      self.info.features["label"].names = [
          v for _, v in sorted(label_id_to_name.items())
      ]
  
      filename_to_label = {
          row["Filename"]: row["Species"] for row in reader
      }
      for file_name in tf.io.gfile.listdir(data_dir_path):
          yield file_name, {
              "image": os.path.join(data_dir_path, file_name),
              "label": filename_to_label[file_name],
          }
  
file_path: datasets/tensorflow_datasets/image_classification/deep_weeds.py
imports: import csv
  import os
  from etils import epath
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 3 for calling the DeepWeeds obj's underlying member method code with example usage: obj._generate_examples(data_dir_path, label_path) without return types