class_docstr: Coco captions dataset with the splits defined by Karpathy and Li 2015.
docstr: Generate examples as dicts.
  
  Args:
    image_filename_to_annotations: `dict` mapping each image filename to its
      caption annotations.
    coco_gen_kwargs: `dict` of kwargs to forward to Coco._generate_examples().
  
  Yields:
    example key and data
docstr_tok: ["Generate","examples","as","dicts",".","Args",":","image_filename_to_annotations",":","`","dict","`","mapping","each","image","filename","to","its","caption","annotations",".","coco_gen_kwargs",":","`","dict","`","of","kwargs","to","forward","to","Coco._generate_examples","(",")",".","Yields",":","example","key","and","data"]
code: def _generate_examples(
      self, image_filename_to_annotations, coco_gen_kwargs
  ):
      """Generate examples as dicts.
  
      Args:
        image_filename_to_annotations: `dict` mapping each image filename to its
          caption annotations.
        coco_gen_kwargs: `dict` of kwargs to forward to Coco._generate_examples().
  
      Yields:
        example key and data
      """
  
      num_generated = 0
      for key, example in super(CocoCaptions, self)._generate_examples(
          **coco_gen_kwargs
      ):
          captions = image_filename_to_annotations.get(
              example["image/filename"]
          )
          if captions is None:
              # Example not in this split.
              continue
  
          # Add caption annotation.
          example["captions"] = [
              dict(id=caption["sentid"], text=caption["raw"])
              for caption in captions["sentences"]
          ]
  
          num_generated += 1
          yield key, example
  
      logging.info("Generated %d examples", num_generated)
  
file_path: datasets/tensorflow_datasets/object_detection/coco_captions.py
imports: from __future__ import annotations
  import collections
  import json
  import os
  from absl import logging
  from etils import epath
  import numpy
  from tensorflow_datasets.object_detection import coco
  import tensorflow_datasets.public_api
label_desc: Use image node_id 3 for calling the CocoCaptions obj's underlying member method code with example usage: obj._generate_examples(image_filename_to_annotations, coco_gen_kwargs) without return types