class_docstr: DatasetBuilder for segment_anything dataset.
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(self, paths: Dict[str, epath.Path]):
      """Yields examples."""
  
      def _extract_examples(path: epath.Path) -> List[epath.Path]:
          return list(path.glob("*.jpg"))
  
      def _process_example(image_path: epath.Path):
          json_content = _parse_json(
              image_path.parent / f"{image_path.stem}.json"
          )
          image = json_content["image"]
          image["content"] = image_path
          height, width = image["height"], image["width"]
          assert (
              height != 0 and width != 0
          ), f"The image {image_path} is malformed."
          annotations = _parse_annotations(
              json_content["annotations"], height, width
          )
          return image["image_id"], {
              "image": image,
              "annotations": annotations,
          }
  
      beam = tfds.core.lazy_imports.apache_beam
      return (
          beam.Create(paths.values())
          | beam.FlatMap(_extract_examples)
          | beam.Map(_process_example)
      )
  
file_path: datasets/tensorflow_datasets/datasets/segment_anything/segment_anything_dataset_builder.py
imports: import csv
  import json
  from typing import Dict, List
  from etils import epath
  import numpy
  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(paths) and returns: unknown, list, image,  dict