code: def generate_metadata(
      train_images_dir, test_images_dir, depths_filepath
  ):
      depths = pd.read_csv(depths_filepath)
      salt_exists_dict = get_salt_existence()
  
      metadata = {}
      for filename in tqdm(
          os.listdir(os.path.join(train_images_dir, "images"))
      ):
          image_filepath = os.path.join(
              train_images_dir, "images", filename
          )
          mask_filepath = os.path.join(
              train_images_dir, "masks", filename
          )
          image_id = filename.split(".")[0]
          depth = depths[depths["id"] == image_id]["z"].values[0]
  
          metadata.setdefault("file_path_image", []).append(
              image_filepath
          )
          metadata.setdefault("file_path_mask", []).append(
              mask_filepath
          )
          metadata.setdefault("is_train", []).append(1)
          metadata.setdefault("id", []).append(image_id)
          metadata.setdefault("z", []).append(depth)
          metadata.setdefault("salt_exists", []).append(
              salt_exists_dict[image_id]
          )
  
      for filename in tqdm(
          os.listdir(os.path.join(test_images_dir, "images"))
      ):
          image_filepath = os.path.join(
              test_images_dir, "images", filename
          )
          image_id = filename.split(".")[0]
          depth = depths[depths["id"] == image_id]["z"].values[0]
  
          metadata.setdefault("file_path_image", []).append(
              image_filepath
          )
          metadata.setdefault("file_path_mask", []).append(None)
          metadata.setdefault("is_train", []).append(0)
          metadata.setdefault("id", []).append(image_id)
          metadata.setdefault("z", []).append(depth)
          metadata.setdefault("salt_exists", []).append(0)
  
      return pd.DataFrame(metadata)
  
imports: import os
  import json
  import sys
  import time
  import numpy
  import pandas
  from PIL import Image
  from tqdm import tqdm
  from pycocotools import mask
  from sklearn.model_selection import KFold
  import settings
label_desc: Use image node_id 7 for calling a global function with example usage: generate_metadata(train_images_dir, test_images_dir, depths_filepath) and returns: pd