code: def get_field_metadata(
      fields: List[FieldInfo], row_count: int, targets: Set[str] = None
  ) -> List[FieldMetadata]:
      """Computes metadata for each field in dataset.
  
      # Inputs
      :param fields: (List[FieldInfo]) FieldInfo objects for all fields in dataset
      :param row_count: (int) total number of entries in original dataset
      :param targets (Set[str]) names of target features
  
      # Return
      :return: (List[FieldMetadata]) list of objects containing metadata for each field
      """
  
      metadata = []
      column_count = len(fields)
      for idx, field in enumerate(fields):
          missing_value_percent = (
              1 - float(field.nonnull_values) / row_count
          )
          dtype = infer_type(field, missing_value_percent, row_count)
          metadata.append(
              FieldMetadata(
                  name=field.name,
                  config=FieldConfig(
                      name=field.name,
                      column=field.name,
                      type=dtype,
                  ),
                  excluded=should_exclude(
                      idx,
                      field,
                      dtype,
                      column_count,
                      row_count,
                      targets,
                  ),
                  mode=infer_mode(field, targets),
                  missing_values=missing_value_percent,
                  imbalance_ratio=field.distinct_values_balance,
              )
          )
  
      return metadata
  
imports: import logging
  import os
  from dataclasses import dataclass
  from typing import Any, Dict, List, Set, Union
  import dask.dataframe
  import numpy
  import pandas
  import yaml
  from dataclasses_json import dataclass_json, LetterCase
  from tqdm import tqdm
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.backend import Backend
  from ludwig.constants import COLUMN, COMBINER, ENCODER, EXECUTOR, HYPEROPT, INPUT_FEATURES, PREPROCESSING, SCHEDULER, SEARCH_ALG, SPLIT, TEXT, TYPE
  from ludwig.types import ModelConfigDict
  from ludwig.utils.automl.data_source import DataSource, wrap_data_source
  from ludwig.utils.automl.field_info import FieldConfig, FieldInfo, FieldMetadata
  from ludwig.utils.automl.type_inference import infer_type, should_exclude
  from ludwig.utils.data_utils import load_yaml
  from ludwig.utils.misc_utils import merge_dict
  from ludwig.utils.system_utils import Resources
label_desc: Use image node_id 13 for calling a global function with example usage: get_field_metadata(fields, row_count, targets) and returns: metadata