class_docstr: The PPMattinh implementation based on PaddlePaddle.
  
  The original article refers to
  Guowei Chen, et, al. "PP-Matting: High-Accuracy Natural Image Matting"
  (https://arxiv.org/pdf/2204.09433.pdf).
  
  Args:
      backbone: backbone model.
      pretrained(str, optional): The path of pretrianed model. Defautl: None.
class_docstr_tok: ["The","PPMattinh","implementation","based","on","PaddlePaddle",".","The","original","article","refers","to","Guowei","Chen",",","et",",","al",".","``","PP-Matting",":","High-Accuracy","Natural","Image","Matting","''","(","https",":","\/\/arxiv.org\/pdf\/2204.09433.pdf",")",".","Args",":","backbone",":","backbone","model",".","pretrained","(","str",",","optional",")",":","The","path","of","pretrianed","model",".","Defautl",":","None","."]
code: def fusion(self, semantic_map, detail_map):
      # semantic_map [N, 3, H, W]
      # In index, 0 is foreground, 1 is transition, 2 is backbone
      # After fusion, the foreground is 1, the background is 0, and the transion is between [0, 1]
      index = paddle.argmax(semantic_map, axis=1, keepdim=True)
      transition_mask = (index == 1).astype("float32")
      fg = (index == 0).astype("float32")
      alpha = detail_map * transition_mask + fg
      return alpha
  
imports: from collections import defaultdict
  import time
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import paddleseg
  from paddleseg.models import layers
  from paddleseg import utils
  from paddleseg.cvlibs import manager
  from ppmatting.models.losses import MRSD, GradientLoss
  from ppmatting.models.backbone import resnet_vd
label_desc: Use image node_id 5 for calling the PPMatting obj's underlying member method code with example usage: obj.fusion(semantic_map, detail_map) and returns: alpha