class_docstr: Pascal VOC 2007 or 2012.
code: def _generate_example(self, data_path, image_id, load_annotations):
      image_filepath = os.path.join(
          data_path,
          os.path.normpath(
              "VOCdevkit/VOC{}/JPEGImages/{}.jpg".format(
                  self.builder_config.year, image_id
              )
          ),
      )
      annon_filepath = os.path.join(
          data_path,
          os.path.normpath(
              "VOCdevkit/VOC{}/Annotations/{}.xml".format(
                  self.builder_config.year, image_id
              )
          ),
      )
      if load_annotations:
          objects = list(_get_example_objects(annon_filepath))
          # Use set() to remove duplicates
          labels = sorted(set(obj["label"] for obj in objects))
          labels_no_difficult = sorted(
              set(
                  obj["label"]
                  for obj in objects
                  if obj["is_difficult"] == 0
              )
          )
      else:  # The test set of VOC2012 does not contain annotations
          objects = []
          labels = []
          labels_no_difficult = []
      return {
          "image": image_filepath,
          "image/filename": image_id + ".jpg",
          "objects": objects,
          "labels": labels,
          "labels_no_difficult": labels_no_difficult,
      }
  
file_path: datasets/tensorflow_datasets/object_detection/voc.py
imports: from __future__ import annotations
  import os
  import xml.etree.ElementTree
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 4 for calling the Voc obj's underlying member method code with example usage: obj._generate_example(data_path, image_id, load_annotations) and returns: dict