class_docstr: 300W-LP dataset.
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(self, image_dir_path):
      """Yields examples."""
      image_files = tf.io.gfile.glob(
          pattern=os.path.join(
              image_dir_path, "[!Code]*[!_Flip]/[!_]*.jpg"
          )
      )
      label_files = [s.replace("jpg", "mat") for s in image_files]
      landmark_files = [
          s.replace("300W_LP", "300W_LP/landmarks").replace(
              ".jpg", "_pts.mat"
          )
          for s in image_files
      ]
      for image_file, label_file, landmark_file in zip(
          image_files, label_files, landmark_files
      ):
          with tf.io.gfile.GFile(label_file, "rb") as f:
              mat = tfds.core.lazy_imports.scipy.io.loadmat(f)
          pt2d_origin = mat["pt2d"].T
          pt2d_origin = (pt2d_origin / 450.0).astype(np.float32)
          roi = mat["roi"].reshape(4).astype(np.float32)
          illum_params = (
              mat["Illum_Para"].reshape([-1]).astype(np.float32)
          )
          color_params = (
              mat["Color_Para"].reshape([-1]).astype(np.float32)
          )
          tex_params = mat["Tex_Para"].reshape([-1]).astype(np.float32)
          shape_params = (
              mat["Shape_Para"].reshape([-1]).astype(np.float32)
          )
          exp_params = mat["Exp_Para"].reshape([-1]).astype(np.float32)
          pose_params = (
              mat["Pose_Para"].reshape([-1]).astype(np.float32)
          )
          with tf.io.gfile.GFile(landmark_file, "rb") as f:
              ldm_mat = tfds.core.lazy_imports.scipy.io.loadmat(f)
              pt2d = (ldm_mat["pts_2d"] / 450.0).astype(np.float32)
              pt3d = (ldm_mat["pts_3d"] / 450.0).astype(np.float32)
          record = {
              "image": image_file,
              "landmarks_origin": pt2d_origin,
              "landmarks_2d": pt2d,
              "landmarks_3d": pt3d,
              "roi": roi,
              "illum_params": illum_params,
              "color_params": color_params,
              "tex_params": tex_params,
              "shape_params": shape_params,
              "exp_params": exp_params,
              "pose_params": pose_params,
          }
          yield os.path.basename(image_file), record
  
file_path: datasets/tensorflow_datasets/datasets/the300w_lp/the300w_lp_dataset_builder.py
imports: import os
  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(image_dir_path) without return types