class_docstr: DatasetBuilder for tao dataset.
class_docstr_tok: ["DatasetBuilder","for","tao","dataset","."]
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(
      self, data_path, manual_path, annotations_path, id_map
  ):
      """Yields examples."""
      beam = tfds.core.lazy_imports.apache_beam
      annotations = _preprocess_annotations(
          annotations_path, id_map
      )  # pytype: disable=wrong-arg-types  # always-use-return-annotations
      outs = _build_annotations_index(annotations)
      vids, ann_to_images, track_to_anns, vid_to_tracks = outs
  
      def _process_example(video_id_and_path):
          """Generate a data example for a single video."""
          # The video_id_and_path are passed together because beam expects
          # a function of a single param (see usage below).
          video_id, path = video_id_and_path
          video_ann = vids[video_id]
          data_example = {}
          frames = self._maybe_resize_video(list(path.iterdir()))
          data_example["video"] = frames
          data_example["metadata"] = self._create_metadata(
              video_ann, len(frames)
          )
          data_example["tracks"] = []
  
          for track in vid_to_tracks[video_id]:
              data_example["tracks"].append(
                  _create_per_track_annotation(
                      track,
                      track_to_anns,
                      ann_to_images,
                      video_ann["height"],
                      video_ann["width"],
                  )
              )
          return video_ann["name"], data_example
  
      filtered_ids = []
      for video_id, video_ann in list(vids.items()):
          # These must be manually downloaded.
          is_manual = (
              "HACS" in video_ann["metadata"]["dataset"]
              or "AVA" in video_ann["metadata"]["dataset"]
          )
          if is_manual and manual_path is None:
              continue
          path = (
              (manual_path if is_manual else data_path)
              / "frames"
              / vids[video_id]["name"]
          )
          filtered_ids.append((video_id, path))
      return beam.Create(filtered_ids) | beam.Map(_process_example)
  
imports: from __future__ import annotations
  import collections
  import json
  import os
  from typing import Any, Dict, Optional, Tuple
  from etils import epath
  import numpy
  import tensorflow_datasets.public_api
label_desc: Use image node_id 5 for calling the Tao obj's underlying member method code with example usage: obj._generate_examples(data_path, manual_path, annotations_path, id_map) and returns: unknown, video_ann,  data_example