code: def from_config(cls, cfg, input_shape):
      bbox_roi_extractor = cfg["bbox_roi_extractor"]
      mask_roi_extractor = cfg["mask_roi_extractor"]
      assert isinstance(bbox_roi_extractor, dict)
      assert isinstance(mask_roi_extractor, dict)
  
      kwargs = RoIAlign.from_config(cfg, input_shape)
      bbox_roi_extractor.update(kwargs)
      mask_roi_extractor.update(kwargs)
  
      return {
          "bbox_roi_extractor": bbox_roi_extractor,
          "mask_roi_extractor": mask_roi_extractor,
      }
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import paddle
  from paddle import nn
  from ppdet.core.workspace import register
  from ppdet.modeling import initializer
  from .roi_extractor import RoIAlign
  from ..bbox_utils import delta2bbox_v2
  from ..cls_utils import _get_class_default_kwargs
  from ..layers import MultiHeadAttention
label_desc: Use image node_id 2 for calling the SparseRoIHead obj's underlying member method code with example usage: obj.from_config(cls, cfg, input_shape) and returns: dict