class_docstr: The ``IceVisionAdapter`` is an :class:`~flash.core.adapter.Adapter` for integrating with IceVision.
code: def from_task(
      cls,
      task: Task,
      num_classes: int,
      backbone: str,
      head: str,
      predict_kwargs: Dict,
      pretrained: bool = True,
      metrics: Optional["IceVisionMetric"] = None,
      image_size: Optional = None,
      **kwargs,
  ) -> Adapter:
      metadata = task.heads.get(head, with_metadata=True)
      backbones = metadata["metadata"]["backbones"]
      backbone_config = backbones.get(backbone)(pretrained)
      model_type, model, icevision_adapter, backbone = metadata["fn"](
          backbone_config,
          num_classes,
          image_size=image_size,
          **kwargs,
      )
  
      if metrics is not None and not isinstance(metrics, list):
          metrics = [metrics]
      icevision_adapter = icevision_adapter(
          model=model, metrics=metrics
      )
      return cls(
          model_type, model, icevision_adapter, backbone, predict_kwargs
      )
  
imports: import functools
  from importlib import import_module
  from typing import Any, Dict, Optional
  from torch import Tensor
  from torch.utils.data import DataLoader, Sampler
  import flash
  from flash.core.adapter import Adapter
  from flash.core.data.io.input import DataKeys, InputBase
  from flash.core.data.io.input_transform import InputTransform, create_worker_input_transform_processor
  from flash.core.integrations.icevision.transforms import from_icevision_predictions, from_icevision_record, to_icevision_record
  from flash.core.integrations.icevision.wrappers import wrap_icevision_adapter
  from flash.core.model import Task
  from flash.core.utilities.imports import _ICEVISION_AVAILABLE
  from flash.core.utilities.stages import RunningStage
  from flash.core.utilities.url_error import catch_url_error
label_desc: Use image node_id 2 for calling the IceVisionAdapter obj's underlying member method code with example usage: obj.from_task(cls, task, num_classes, backbone, head, predict_kwargs, pretrained, metrics, image_size) and returns: cls