class_docstr: The MODNet implementation based on PaddlePaddle.
  
  The original article refers to
  Zhanghan Ke, et, al. "Is a Green Screen Really Necessary for Real-Time Portrait Matting?"
  (https://arxiv.org/pdf/2011.11961.pdf).
  
  Args:
      backbone: backbone model.
      hr(int, optional): The channels of high resolutions branch. Defautl: None.
      pretrained(str, optional): The path of pretrianed model. Defautl: None.
class_docstr_tok: ["The","MODNet","implementation","based","on","PaddlePaddle",".","The","original","article","refers","to","Zhanghan","Ke",",","et",",","al",".","``","Is","a","Green","Screen","Really","Necessary","for","Real-Time","Portrait","Matting","?","''","(","https",":","\/\/arxiv.org\/pdf\/2011.11961.pdf",")",".","Args",":","backbone",":","backbone","model",".","hr","(","int",",","optional",")",":","The","channels","of","high","resolutions","branch",".","Defautl",":","None",".","pretrained","(","str",",","optional",")",":","The","path","of","pretrianed","model",".","Defautl",":","None","."]
docstr: If training, return a dict.
  If evaluation, return the final alpha prediction.
docstr_tok: ["If","training",",","return","a","dict",".","If","evaluation",",","return","the","final","alpha","prediction","."]
code: def forward(self, inputs):
      """
      If training, return a dict.
      If evaluation, return the final alpha prediction.
      """
      x = inputs["img"]
      feat_list = self.backbone(x)
      y = self.head(inputs=inputs, feat_list=feat_list)
      if self.training:
          loss = self.loss(y, inputs)
          return y, loss
      else:
          return y
  
imports: from collections import defaultdict
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import numpy
  import scipy
  import paddleseg
  from paddleseg.models import layers, losses
  from paddleseg import utils
  from paddleseg.cvlibs import manager, param_init
label_desc: Use image node_id 2 for calling the MODNet obj's underlying member method code with example usage: obj.forward(inputs) and returns: y,  loss, y