code: def test_metric_collection_configuration_callback(config_from_yaml):
      """Test if metrics are properly instantiated."""
  
      callback = MetricsConfigurationCallback(
          task="segmentation",
          image_metrics=config_from_yaml.metrics.image,
          pixel_metrics=config_from_yaml.metrics.pixel,
      )
  
      dummy_logger = DummyLogger()
      dummy_anomaly_module = _DummyAnomalyModule()
      trainer = pl.Trainer(
          callbacks=[callback],
          logger=dummy_logger,
          enable_checkpointing=False,
          default_root_dir=dummy_logger.tempdir,
      )
      callback.setup(trainer, dummy_anomaly_module, DummyDataModule())
  
      assert isinstance(
          dummy_anomaly_module.image_metrics, AnomalibMetricCollection
      ), f"{dummy_anomaly_module.image_metrics}"
      assert isinstance(
          dummy_anomaly_module.pixel_metrics, AnomalibMetricCollection
      ), f"{dummy_anomaly_module.pixel_metrics}"
  
imports: from itertools import chain
  from pathlib import Path
  from collections import OrderedDict
  import pytest
  import pytorch_lightning
  from omegaconf import OmegaConf
  import torch
  from anomalib.models.components import AnomalyModule
  from anomalib.utils.callbacks.metrics_configuration import MetricsConfigurationCallback
  from anomalib.utils.metrics.collection import AnomalibMetricCollection
  from tests.helpers.dummy import DummyDataModule, DummyLogger, DummyModel
label_desc: Use image node_id 2 for calling a global function with example usage: test_metric_collection_configuration_callback(config_from_yaml) without return types