class_docstr: Caltech Birds 2010 dataset.
docstr: Generate birds images, labels and bounding box given the directory path.
  
  Args:
      archive: object that iterates over the zip file_names : list of
        train/test image file names obtained from mat file annotations : dict
        of image file names and bbox attributes, segmentation labels
      file_names: file names.
      annotations: annotations.
  
  Yields:
      The key and examples. Examples consist of image path, image file name,
      its corresponding label, bounding box values, and segmentation mask.
docstr_tok: ["Generate","birds","images",",","labels","and","bounding","box","given","the","directory","path",".","Args",":","archive",":","object","that","iterates","over","the","zip","file_names",":","list","of","train\/test","image","file","names","obtained","from","mat","file","annotations",":","dict","of","image","file","names","and","bbox","attributes",",","segmentation","labels","file_names",":","file","names",".","annotations",":","annotations",".","Yields",":","The","key","and","examples",".","Examples","consist","of","image","path",",","image","file","name",",","its","corresponding","label",",","bounding","box","values",",","and","segmentation","mask","."]
code: def _generate_examples(self, archive, file_names, annotations):
      """Generate birds images, labels and bounding box given the directory path.
  
      Args:
          archive: object that iterates over the zip file_names : list of
            train/test image file names obtained from mat file annotations : dict
            of image file names and bbox attributes, segmentation labels
          file_names: file names.
          annotations: annotations.
  
      Yields:
          The key and examples. Examples consist of image path, image file name,
          its corresponding label, bounding box values, and segmentation mask.
      """
  
      def process_file(element):
          fname, fobj = element
          fname = fname.replace("\\", "/")  # For windows compatibility
          res = _NAME_RE.match(fname)
  
          # Checking if filename is present in respective train/test list
          if (
              not res
              or "/".join(fname.split("/")[-2:]) not in file_names
          ):
              return
          matches = res.groups()
          label_name = matches[
              -2
          ].lower()  # pytype: disable=attribute-error
          label_key = int(matches[-3]) - 1
          file_name = matches[-1].split(".")[
              0
          ]  # pytype: disable=attribute-error
          segmentation_mask = annotations[file_name][1]
          height, width = segmentation_mask.shape
          bbox = self._get_bounding_box_values(
              annotations[file_name][0], width, height
          )
          return fname, {
              "image": fobj,
              "image/filename": fname,
              "label": label_key,
              "label_name": label_name,
              "bbox": tfds.features.BBox(
                  ymin=min(bbox[0], 1.0),
                  xmin=min(bbox[1], 1.0),
                  ymax=min(bbox[2], 1.0),
                  xmax=min(bbox[3], 1.0),
              ),
              "segmentation_mask": segmentation_mask[:, :, np.newaxis],
          }
  
      with concurrent.futures.ThreadPoolExecutor(
          max_workers=_WORKERS
      ) as executor:
          for example in executor.map(process_file, archive):
              if example:
                  yield example
  
imports: import collections
  import concurrent.futures
  import os
  import re
  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 5 for calling the CaltechBirds2010 obj's underlying member method code with example usage: obj._generate_examples(archive, file_names, annotations) and returns: fname,  dict