class_docstr: ResNet backbone with frozen BatchNorm.
class_docstr_tok: ["ResNet","backbone","with","frozen","BatchNorm","."]
code: def __init__(
      self,
      name: str,
      train_backbone: bool,
      return_interm_layers: bool,
      dilation: bool,
  ):
      backbone = getattr(torchvision.models, name)(
          replace_stride_with_dilation=[False, False, dilation],
          pretrained=is_main_process(),
          norm_layer=FrozenBatchNorm2d,
      )
      num_channels = 512 if name in ("resnet18", "resnet34") else 2048
      super().__init__(
          backbone, train_backbone, num_channels, return_interm_layers
      )
  
imports: from collections import OrderedDict
  import torch
  import torch.nn.functional
  import torchvision
  from torch import nn
  from torchvision.models._utils import IntermediateLayerGetter
  from typing import Dict, List
  from util.misc import NestedTensor, is_main_process
  from .position_encoding import build_position_encoding
label_desc: Use image node_id 1 to create a new Backbone object from inherited base classes: BackboneBase with example: obj = Backbone(name, train_backbone, return_interm_layers, dilation)