code: def __init__(
      self,
      encoder,
      n_classes,
      blur=False,
      blur_final=True,
      self_attention=False,
      y_range=None,
      last_cross=True,
      bottle=False,
      norm_type="Batch",
      nf_factor=1,
      **kwargs,
  ):
      imsize = (256, 256)
      sfs_szs = U.model_sizes(encoder, size=imsize)
      sfs_idxs = list(reversed(_get_sfs_idxs(sfs_szs)))
      self.sfs = U.hook_outputs(
          [encoder[i] for i in sfs_idxs], detach=False
      )
      x = U.dummy_eval(encoder, imsize).detach()
  
      nf = 512 * nf_factor
      extra_bn = norm_type == "Spectral"
      ni = sfs_szs[-1][1]
      middle_conv = nn.Sequential(
          custom_conv_layer(
              ni, ni * 2, norm_type=norm_type, extra_bn=extra_bn
          ),
          custom_conv_layer(
              ni * 2, ni, norm_type=norm_type, extra_bn=extra_bn
          ),
      )
  
      layers = [encoder, nn.BatchNorm(ni), nn.ReLU(), middle_conv]
  
      for i, idx in enumerate(sfs_idxs):
          not_final = i != len(sfs_idxs) - 1
          up_in_c, x_in_c = int(x.shape[1]), int(sfs_szs[idx][1])
          do_blur = blur and (not_final or blur_final)
          sa = self_attention and (i == len(sfs_idxs) - 3)
  
          n_out = nf if not_final else nf // 2
  
          unet_block = UnetBlockWide(
              up_in_c,
              x_in_c,
              n_out,
              self.sfs[i],
              final_div=not_final,
              blur=blur,
              self_attention=sa,
              norm_type=norm_type,
              extra_bn=extra_bn,
              **kwargs,
          )
          unet_block.eval()
          layers.append(unet_block)
          x = unet_block(x)
  
      ni = x.shape[1]
      if imsize != sfs_szs[0][-2:]:
          layers.append(PixelShuffle_ICNR(ni, **kwargs))
      if last_cross:
          layers.append(MergeLayer(dense=True))
          ni += 3
          layers.append(
              res_block(
                  ni, bottle=bottle, norm_type=norm_type, **kwargs
              )
          )
      layers += [
          custom_conv_layer(
              ni, n_classes, ks=1, use_activ=False, norm_type=norm_type
          )
      ]
      if y_range is not None:
          layers.append(SigmoidRange(*y_range))
      super().__init__(*layers)
  
imports: import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle.vision.models import resnet101
  from .None import utils
label_desc: Use image node_id 1 to create a new Deoldify object from inherited base classes: SequentialEx with example: obj = Deoldify(encoder, n_classes, blur, blur_final, _attention, y_range, last_cross, bottle, norm_type, nf_factor)