code: def read_metadata(path):
      """Load metadata in JSON format from a path into a new DatasetMetadata."""
      schema_file = os.path.join(path, "schema.pbtxt")
      legacy_schema_file = os.path.join(path, "v1-json", "schema.json")
      if file_io.file_exists(schema_file):
          text_proto = file_io.FileIO(schema_file, "r").read()
          schema_proto = text_format.Parse(
              text_proto,
              schema_pb2.Schema(),
              allow_unknown_extension=True,
          )
      elif file_io.file_exists(legacy_schema_file):
          schema_json = file_io.FileIO(legacy_schema_file, "r").read()
          schema_proto = _parse_schema_json(schema_json)
      else:
          raise IOError(
              "Schema file {} does not exist and neither did legacy format file "
              "{}".format(schema_file, legacy_schema_file)
          )
      return dataset_metadata.DatasetMetadata(schema_proto)
  
file_path: transform/tensorflow_transform/tf_metadata/metadata_io.py
imports: import json
  import os
  import tensorflow
  from tensorflow_transform.tf_metadata import dataset_metadata
  from tensorflow_transform.tf_metadata import schema_utils
  from google.protobuf import text_format
  from tensorflow.python.lib.io import file_io
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: read_metadata(path) and returns: dataset_metadata