code: def from_config(cls, cfg, *args, **kwargs):
      # backbone
      backbone = create(cfg["backbone"])
      # neck
      kwargs = {"input_shape": backbone.out_shape}
      neck = create(cfg["neck"], **kwargs) if cfg["neck"] else None
  
      # transformer
      if neck is not None:
          kwargs = {"input_shape": neck.out_shape}
      transformer = create(cfg["transformer"], **kwargs)
      # head
      kwargs = {
          "hidden_dim": transformer.hidden_dim,
          "nhead": transformer.nhead,
          "input_shape": backbone.out_shape,
      }
      detr_head = create(cfg["detr_head"], **kwargs)
  
      return {
          "backbone": backbone,
          "transformer": transformer,
          "detr_head": detr_head,
          "neck": neck,
      }
  
file_path: PaddleDetection/ppdet/modeling/architectures/detr.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  from .meta_arch import BaseArch
  from ppdet.core.workspace import register, create
label_desc: Use image node_id 2 for calling the DETR obj's underlying member method code with example usage: obj.from_config(cls, cfg) and returns: dict