class_docstr: Blood Cell Count and Detection Dataset.
class_docstr_tok: ["Blood","Cell","Count","and","Detection","Dataset","."]
docstr: Yeilds Examples.
  
  Args:
    file_names: The path of the file that contains the splits
    extracted_dir_path: The path of the extracted folder
  
  Yields:
    Generator yielding the next examples
docstr_tok: ["Yeilds","Examples",".","Args",":","file_names",":","The","path","of","the","file","that","contains","the","splits","extracted_dir_path",":","The","path","of","the","extracted","folder","Yields",":","Generator","yielding","the","next","examples"]
code: def _generate_examples(self, file_names, extracted_dir_path):
      """Yeilds Examples.
  
      Args:
        file_names: The path of the file that contains the splits
        extracted_dir_path: The path of the extracted folder
  
      Yields:
        Generator yielding the next examples
      """
  
      bbox_attrib = ["xmin", "xmax", "ymin", "ymax", "width", "height"]
      xml_list = collections.defaultdict(str)
  
      images_dir_path = os.path.join(
          extracted_dir_path, "BCCD", "JPEGImages"
      )
  
      annotations_dir_path = os.path.join(
          extracted_dir_path, "BCCD", "Annotations"
      )
  
      def get_image_file_path(filename):
          """Returns image path."""
          return os.path.join(
              images_dir_path, "{}.jpg".format(filename.strip())
          )
  
      def get_annotations_file_path(filename):
          """Returns annotations file path."""
          return os.path.join(
              annotations_dir_path, "{}.xml".format(filename.strip())
          )
  
      # BBox attributes in range of 0.0 to 1.0
      def normalize_bbox(bbox_side, image_side):
          return min(bbox_side / image_side, 1.0)
  
      def build_box(attributes, n):
          return tfds.features.BBox(
              ymin=normalize_bbox(
                  attributes["ymin"][n], attributes["height"][0]
              ),
              xmin=normalize_bbox(
                  attributes["xmin"][n], attributes["width"][0]
              ),
              ymax=normalize_bbox(
                  attributes["ymax"][n], attributes["height"][0]
              ),
              xmax=normalize_bbox(
                  attributes["xmax"][n], attributes["width"][0]
              ),
          )
  
      def get_label(attributes, n):
          return attributes["name"][n]
  
      for fname in file_names:
          annotation_file_path = get_annotations_file_path(fname)
          with epath.Path(annotation_file_path).open() as f:
              xml_list[fname] = ET.parse(f)
          attributes = collections.defaultdict(list)
          for element in xml_list[fname].iter():
              # Extract necessary Bbox attributes from XML file
              # "Name" tag contains the label
              if element.tag.strip() == "name":
                  attributes[element.tag.strip()].append(
                      element.text.strip()
                  )
              elif element.tag.strip() in bbox_attrib:
                  attributes[element.tag.strip()].append(
                      float(element.text.strip())
                  )
  
          key = fname
          example = {
              "image": get_image_file_path(fname),
              "image/filename": fname,
              "objects": [
                  {  # pylint: disable=g-complex-comprehension
                      "label": get_label(attributes, n),
                      "bbox": build_box(attributes, n),
                  }
                  for n in range(len(attributes["name"]))
              ],
          }
          yield key, example
  
file_path: datasets/tensorflow_datasets/datasets/bccd/bccd_dataset_builder.py
imports: import collections
  import os
  import xml.etree.ElementTree
  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 Builder obj's underlying member method code with example usage: obj._generate_examples(file_names, extracted_dir_path) and returns: os, os, min, tfds, attributes