code: def _dbnet(
      arch: str,
      pretrained: bool,
      backbone_fn: Callable[[bool], nn.Module],
      fpn_layers: List[str],
      backbone_submodule: Optional[str] = None,
      pretrained_backbone: bool = True,
      ignore_keys: Optional[List[str]] = None,
      **kwargs: Any,
  ) -> DBNet:
      pretrained_backbone = pretrained_backbone and not pretrained
  
      # Feature extractor
      backbone = (
          backbone_fn(pretrained_backbone)
          if not arch.split("_")[1].startswith("resnet")
          # Starting with Imagenet pretrained params introduces some NaNs in layer3 & layer4 of resnet50
          else backbone_fn(weights=None)  # type: ignore[call-arg]
      )
      if isinstance(backbone_submodule, str):
          backbone = getattr(backbone, backbone_submodule)
      feat_extractor = IntermediateLayerGetter(
          backbone,
          {
              layer_name: str(idx)
              for idx, layer_name in enumerate(fpn_layers)
          },
      )
  
      if not kwargs.get("class_names", None):
          kwargs["class_names"] = default_cfgs[arch].get(
              "class_names", [CLASS_NAME]
          )
      else:
          kwargs["class_names"] = sorted(kwargs["class_names"])
      # Build the model
      model = DBNet(feat_extractor, cfg=default_cfgs[arch], **kwargs)
      # Load pretrained parameters
      if pretrained:
          # The number of class_names is not the same as the number of classes in the pretrained model =>
          # remove the layer weights
          _ignore_keys = (
              ignore_keys
              if kwargs["class_names"]
              != default_cfgs[arch].get("class_names", [CLASS_NAME])
              else None
          )
          load_pretrained_params(
              model, default_cfgs[arch]["url"], ignore_keys=_ignore_keys
          )
  
      return model
  
imports: from typing import Any, Callable, Dict, List, Optional
  import numpy
  import torch
  from torch import nn
  from torch.nn import functional
  from torchvision.models import resnet34, resnet50
  from torchvision.models._utils import IntermediateLayerGetter
  from torchvision.ops.deform_conv import DeformConv2d
  from doctr.file_utils import CLASS_NAME
  from ...classification import mobilenet_v3_large
  from ...utils import _bf16_to_float32, load_pretrained_params
  from .base import DBPostProcessor, _DBNet
label_desc: Use image node_id 1 for calling a global function with example usage: _dbnet(arch, pretrained, backbone_fn, fpn_layers, backbone_submodule, pretrained_backbone, ignore_keys) and returns: model