class_docstr: DBNet as described in `"Real-time Scene Text Detection with Differentiable Binarization"
  <https://arxiv.org/pdf/1911.08947.pdf>`_.
  
  Args:
  ----
      feature extractor: the backbone serving as feature extractor
      head_chans: the number of channels in the head
      deform_conv: whether to use deformable convolution
      assume_straight_pages: if True, fit straight bounding boxes only
      exportable: onnx exportable returns only logits
      cfg: the configuration dict of the model
      class_names: list of class names
class_docstr_tok: ["DBNet","as","described","in","`","``","Real-time","Scene","Text","Detection","with","Differentiable","Binarization","''","<","https",":","\/\/arxiv.org\/pdf\/1911.08947.pdf",">","`","_",".","Args",":","--","--","feature","extractor",":","the","backbone","serving","as","feature","extractor","head_chans",":","the","number","of","channels","in","the","head","deform_conv",":","whether","to","use","deformable","convolution","assume_straight_pages",":","if","True",",","fit","straight","bounding","boxes","only","exportable",":","onnx","exportable","returns","only","logits","cfg",":","the","configuration","dict","of","the","model","class_names",":","list","of","class","names"]
code: def __init__(
      self,
      feat_extractor: IntermediateLayerGetter,
      head_chans: int = 256,
      deform_conv: bool = False,
      bin_thresh: float = 0.3,
      assume_straight_pages: bool = True,
      exportable: bool = False,
      cfg: Optional[Dict[str, Any]] = None,
      class_names: List[str] = [CLASS_NAME],
  ) -> None:
      super().__init__()
      self.class_names = class_names
      num_classes: int = len(self.class_names)
      self.cfg = cfg
  
      conv_layer = DeformConv2d if deform_conv else nn.Conv2d
  
      self.exportable = exportable
      self.assume_straight_pages = assume_straight_pages
  
      self.feat_extractor = feat_extractor
      # Identify the number of channels for the head initialization
      _is_training = self.feat_extractor.training
      self.feat_extractor = self.feat_extractor.eval()
      with torch.no_grad():
          out = self.feat_extractor(torch.zeros((1, 3, 224, 224)))
          fpn_channels = [v.shape[1] for _, v in out.items()]
  
      if _is_training:
          self.feat_extractor = self.feat_extractor.train()
  
      self.fpn = FeaturePyramidNetwork(
          fpn_channels, head_chans, deform_conv
      )
      # Conv1 map to channels
  
      self.prob_head = nn.Sequential(
          conv_layer(
              head_chans, head_chans // 4, 3, padding=1, bias=False
          ),
          nn.BatchNorm2d(head_chans // 4),
          nn.ReLU(inplace=True),
          nn.ConvTranspose2d(
              head_chans // 4, head_chans // 4, 2, stride=2, bias=False
          ),
          nn.BatchNorm2d(head_chans // 4),
          nn.ReLU(inplace=True),
          nn.ConvTranspose2d(head_chans // 4, num_classes, 2, stride=2),
      )
      self.thresh_head = nn.Sequential(
          conv_layer(
              head_chans, head_chans // 4, 3, padding=1, bias=False
          ),
          nn.BatchNorm2d(head_chans // 4),
          nn.ReLU(inplace=True),
          nn.ConvTranspose2d(
              head_chans // 4, head_chans // 4, 2, stride=2, bias=False
          ),
          nn.BatchNorm2d(head_chans // 4),
          nn.ReLU(inplace=True),
          nn.ConvTranspose2d(head_chans // 4, num_classes, 2, stride=2),
      )
  
      self.postprocessor = DBPostProcessor(
          assume_straight_pages=assume_straight_pages,
          bin_thresh=bin_thresh,
      )
  
      for n, m in self.named_modules():
          # Don't override the initialization of the backbone
          if n.startswith("feat_extractor."):
              continue
          if isinstance(m, (nn.Conv2d, DeformConv2d)):
              nn.init.kaiming_normal_(
                  m.weight.data, mode="fan_out", nonlinearity="relu"
              )
              if m.bias is not None:
                  m.bias.data.zero_()
          elif isinstance(m, nn.BatchNorm2d):
              m.weight.data.fill_(1.0)
              m.bias.data.zero_()
  
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 to create a new DBNet object from inherited base classes: _DBNet, nn with example: obj = DBNet(feat_extractor, head_chans, deform_conv, bin_thresh, assume_straight_pages, exportable, cfg, class_names)