class_docstr: The DIM implementation based on PaddlePaddle.
  
  The original article refers to
  Ning Xu, et, al. "Deep Image Matting"
  (https://arxiv.org/pdf/1908.07919.pdf).
  
  Args:
      backbone: backbone model.
      stage (int, optional): The stage of model. Defautl: 3.
      decoder_input_channels(int, optional): The channel of decoder input. Default: 512.
      pretrained(str, optional): The path of pretrianed model. Defautl: None.
class_docstr_tok: ["The","DIM","implementation","based","on","PaddlePaddle",".","The","original","article","refers","to","Ning","Xu",",","et",",","al",".","``","Deep","Image","Matting","''","(","https",":","\/\/arxiv.org\/pdf\/1908.07919.pdf",")",".","Args",":","backbone",":","backbone","model",".","stage","(","int",",","optional",")",":","The","stage","of","model",".","Defautl",":","3.","decoder_input_channels","(","int",",","optional",")",":","The","channel","of","decoder","input",".","Default",":","512.","pretrained","(","str",",","optional",")",":","The","path","of","pretrianed","model",".","Defautl",":","None","."]
code: def __init__(
      self,
      backbone,
      stage=3,
      decoder_input_channels=512,
      pretrained=None,
  ):
      super().__init__()
      self.backbone = backbone
      self.pretrained = pretrained
      self.stage = stage
      self.loss_func_dict = None
  
      decoder_output_channels = [64, 128, 256, 512]
      self.decoder = Decoder(
          input_channels=decoder_input_channels,
          output_channels=decoder_output_channels,
      )
      if self.stage == 2:
          for param in self.backbone.parameters():
              param.stop_gradient = True
          for param in self.decoder.parameters():
              param.stop_gradient = True
      if self.stage >= 2:
          self.refine = Refine()
      self.init_weight()
  
imports: from collections import defaultdict
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.models import layers
  from paddleseg import utils
  from paddleseg.cvlibs import manager
  from ppmatting.models.losses import MRSD
label_desc: Use image node_id 1 to create a new DIM object from inherited base classes: nn with example: obj = DIM(backbone, stage, decoder_input_channels, pretrained)