code: def __init__(
      self,
      num_classes,
      in_channels=3,
      backbone="resnet101",
      pretrained=True,
      fpn_out=256,
      freeze_bn=False,
      freeze_backbone=False,
      **_,
  ):
      super(UperNet, self).__init__()
  
      if backbone in ("resnet34", "resnet18"):
          feature_channels = [64, 128, 256, 512]
      else:
          feature_channels = [256, 512, 1024, 2048]
      self.backbone = ResNet(in_channels, pretrained=pretrained)
      self.PPN = PSPModule(feature_channels[-1])
      self.FPN = FPN_fuse(feature_channels, fpn_out=fpn_out)
      self.head = nn.Conv2d(
          fpn_out, num_classes, kernel_size=3, padding=1
      )
      if freeze_bn:
          self.freeze_bn()
      if freeze_backbone:
          set_trainable([self.backbone], False)
  
imports: import torch
  import logging
  import torch.nn
  import torch.nn.functional
  from torchvision import models
  from itertools import chain
  import numpy
  from collections import OrderedDict
label_desc: Use image node_id 1 to create a new UperNet object from inherited base classes: BaseModel with example: obj = UperNet(num_classes, in_channels, backbone, pretrained, fpn_out, freeze_bn, freeze_backbone)