code: def test_pretrained_weights(mock_smp):
      mock_smp.create_model = unittest.mock.MagicMock()
      available_weights = (
          SemanticSegmentation.available_pretrained_weights("resnet18")
      )
      backbone = SEMANTIC_SEGMENTATION_BACKBONES.get("resnet18")()
      SEMANTIC_SEGMENTATION_HEADS.get("unet")(
          backbone=backbone, num_classes=10, pretrained=True
      )
  
      kwargs = {
          "arch": "unet",
          "classes": 10,
          "encoder_name": "resnet18",
          "in_channels": 3,
          "encoder_weights": "imagenet",
      }
      mock_smp.create_model.assert_called_with(**kwargs)
  
      for weight in available_weights:
          SEMANTIC_SEGMENTATION_HEADS.get("unet")(
              backbone=backbone, num_classes=10, pretrained=weight
          )
          kwargs["encoder_weights"] = weight
          mock_smp.create_model.assert_called_with(**kwargs)
  
file_path: lightning-flash/tests/image/semantic_segm/test_heads.py
imports: import unittest
  import pytest
  import torch
  from flash.core.utilities.imports import _SEGMENTATION_MODELS_AVAILABLE
  from flash.image.segmentation import SemanticSegmentation
  from flash.image.segmentation.backbones import SEMANTIC_SEGMENTATION_BACKBONES
  from flash.image.segmentation.heads import SEMANTIC_SEGMENTATION_HEADS
label_desc: Use image node_id 2 for calling a global function with example usage: test_pretrained_weights(mock_smp) without return types