class_docstr: Robot pushing dataset from BAIR (Small 64x64 version).
code: def _generate_examples(self, filedir):
      logging.info("Reading data from %s.", filedir)
      files = tf.io.gfile.listdir(filedir)
      logging.info("%d files found.", len(files))
  
      # For each file
      for filename in sorted(tf.io.gfile.listdir(filedir)):
          filepath = os.path.join(filedir, filename)
  
          # For each video inside the file
          for video_id, example_str in enumerate(
              tf.compat.v1.io.tf_record_iterator(filepath)
          ):
              example = tf.train.SequenceExample.FromString(example_str)
  
              # Merge all frames together
              all_frames = []
              for frame_id in range(FRAMES_PER_VIDEO):
                  # Extract all features from the original proto context field
                  frame_feature = (
                      {  # pylint: disable=g-complex-comprehension
                          out_key: example.context.feature[
                              in_key.format(frame_id)
                          ]  # pylint: disable=g-complex-comprehension
                          for out_key, in_key in [
                              ("image_main", "{}/image_main/encoded"),
                              ("image_aux1", "{}/image_aux1/encoded"),
                              ("endeffector_pos", "{}/endeffector_pos"),
                              ("action", "{}/action"),
                          ]
                      }
                  )
  
                  # Decode float
                  for key in ("endeffector_pos", "action"):
                      values = frame_feature[key].float_list.value
                      frame_feature[key] = [
                          values[i] for i in range(len(values))
                      ]
  
                  # Decode images (from encoded string)
                  for key in ("image_main", "image_aux1"):
                      img = frame_feature[key].bytes_list.value[
                          0
                      ]  # pytype: disable=attribute-error
                      img = np.frombuffer(img, dtype=np.uint8)
                      img = np.reshape(img, IMG_SHAPE)
                      frame_feature[key] = img
  
                  all_frames.append(frame_feature)
  
              # Encode the sequence (list) of frames (feature dicts)
              # yield [
              #     {'action': [...], 'image_main': img_frame0, ...},  # Frame 0
              #     {'action': [...], 'image_main': img_frame1, ...},  # Frame 1
              #     ...,
              # ]
              yield "%s_%s" % (filename, video_id), all_frames
  
file_path: datasets/tensorflow_datasets/datasets/bair_robot_pushing_small/bair_robot_pushing_small_dataset_builder.py
imports: import os
  from absl import logging
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  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(filedir) without return types