class_docstr: Diabetic retinopathy detection.
docstr: Yields Example instances from given CSV.
  
  Args:
    images_dir_path: path to dir in which images are stored.
    csv_path: optional, path to csv file with two columns: name of image and
      label. If not provided, just scan image directory, don't set labels.
    csv_usage: optional, subset of examples from the csv file to use based on
      the "Usage" column from the csv.
docstr_tok: ["Yields","Example","instances","from","given","CSV",".","Args",":","images_dir_path",":","path","to","dir","in","which","images","are","stored",".","csv_path",":","optional",",","path","to","csv","file","with","two","columns",":","name","of","image","and","label",".","If","not","provided",",","just","scan","image","directory",",","do","n't","set","labels",".","csv_usage",":","optional",",","subset","of","examples","from","the","csv","file","to","use","based","on","the","``","Usage","''","column","from","the","csv","."]
code: def _generate_examples(
      self, images_dir_path, csv_path=None, csv_usage=None
  ):
      """Yields Example instances from given CSV.
  
      Args:
        images_dir_path: path to dir in which images are stored.
        csv_path: optional, path to csv file with two columns: name of image and
          label. If not provided, just scan image directory, don't set labels.
        csv_usage: optional, subset of examples from the csv file to use based on
          the "Usage" column from the csv.
      """
      if csv_path:
          with epath.Path(csv_path).open() as csv_f:
              reader = csv.DictReader(csv_f)
              data = [
                  (row["image"], int(row["level"]))
                  for row in reader
                  if csv_usage is None or row["Usage"] == csv_usage
              ]
      else:
          data = [
              (fname[:-5], -1)
              for fname in tf.io.gfile.listdir(images_dir_path)
              if fname.endswith(".jpeg")
          ]
      for name, label in data:
          image_filepath = "%s/%s.jpeg" % (images_dir_path, name)
          record = {
              "name": name,
              "image": self._process_image(image_filepath),
              "label": label,
          }
          yield name, record
  
imports: import csv
  import io
  import os
  from absl import logging
  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 3 for calling the DiabeticRetinopathyDetection obj's underlying member method code with example usage: obj._generate_examples(images_dir_path, csv_path, csv_usage) without return types