code: def __init__(self, backbone=None, num_classes=21):
      super(SSD300, self).__init__()
      if backbone is None:
          raise Exception("backbone is None")
      if not hasattr(backbone, "out_channels"):
          raise Exception("the backbone not has attribute: out_channel")
      self.feature_extractor = backbone
  
      self.num_classes = num_classes
      # out_channels = [1024, 512, 512, 256, 256, 256] for resnet50
      self._build_additional_features(
          self.feature_extractor.out_channels
      )
      self.num_defaults = [4, 6, 6, 6, 4, 4]
      location_extractors = []
      confidence_extractors = []
  
      # out_channels = [1024, 512, 512, 256, 256, 256] for resnet50
      for nd, oc in zip(
          self.num_defaults, self.feature_extractor.out_channels
      ):
          # nd is number_default_boxes, oc is output_channel
          location_extractors.append(
              nn.Conv2d(oc, nd * 4, kernel_size=3, padding=1)
          )
          confidence_extractors.append(
              nn.Conv2d(
                  oc, nd * self.num_classes, kernel_size=3, padding=1
              )
          )
  
      self.loc = nn.ModuleList(location_extractors)
      self.conf = nn.ModuleList(confidence_extractors)
      self._init_weights()
  
      default_box = dboxes300_coco()
      self.compute_loss = Loss(default_box)
      self.encoder = Encoder(default_box)
      self.postprocess = PostProcess(default_box)
  
imports: import torch
  from torch import nn, Tensor
  from torch.jit.annotations import List
  from .res50_backbone import resnet50
  from .utils import dboxes300_coco, Encoder, PostProcess
label_desc: Use image node_id 1 to create a new SSD300 object from inherited base classes: nn with example: obj = SSD300(backbone, num_classes)