code: def get_model_metadata(model: AnomalyModule) -> dict[str, Tensor]:
      """Get meta data related to normalization from model.
  
      Args:
          model (AnomalyModule): Anomaly model which contains metadata related to normalization.
  
      Returns:
          dict[str, Tensor]: Model metadata
      """
      metadata = {}
      cached_metadata: dict[str, Number | Tensor] = {
          "image_threshold": model.image_threshold.cpu().value.item(),
          "pixel_threshold": model.pixel_threshold.cpu().value.item(),
      }
      if (
          hasattr(model, "normalization_metrics")
          and model.normalization_metrics.state_dict() is not None
      ):
          for (
              key,
              value,
          ) in model.normalization_metrics.state_dict().items():
              cached_metadata[key] = value.cpu()
      # Remove undefined values by copying in a new dict
      for key, val in cached_metadata.items():
          if not np.isinf(val).all():
              metadata[key] = val
      del cached_metadata
      return metadata
  
imports: from __future__ import annotations
  import json
  import logging
  import subprocess
  from enum import Enum
  from importlib.util import find_spec
  from pathlib import Path
  from typing import Any
  from warnings import warn
  import numpy
  import torch
  from torch import Tensor
  from torch.types import Number
  from anomalib.data.task_type import TaskType
  from anomalib.models.components import AnomalyModule
label_desc: Use image node_id 1 for calling a global function with example usage: get_model_metadata(model) and returns: metadata