docstr: recover pred to origin shape
docstr_tok: ["recover","pred","to","origin","shape"]
code: def _postprocess(self, alpha, trans_info, trimap=None):
      """recover pred to origin shape"""
      if trimap is not None:
          trimap = trimap.squeeze(0)
          alpha[trimap == 0] = 0
          alpha[trimap == 255] = 1
      for item in trans_info[::-1]:
          if item[0] == "resize":
              h, w = item[1][0], item[1][1]
              alpha = cv2.resize(
                  alpha, (w, h), interpolation=cv2.INTER_LINEAR
              )
          elif item[0] == "padding":
              h, w = item[1][0], item[1][1]
              alpha = alpha[0:h, 0:w]
          else:
              raise Exception(
                  "Unexpected info '{}' in im_info".format(item[0])
              )
      return alpha
  
imports: import argparse
  import codecs
  import os
  import sys
  import cv2
  import tqdm
  import yaml
  import numpy
  import paddle
  from paddle.inference import create_predictor, PrecisionType
  from paddle.inference import Config
  from paddleseg.cvlibs import manager
  from paddleseg.utils import get_sys_env, logger
  import ppmatting.transforms
  from ppmatting.utils import get_image_list, mkdir, estimate_foreground_ml, VideoReader, VideoWriter
label_desc: Use image node_id 7 for calling the Predictor obj's underlying member method code with example usage: obj._postprocess(alpha, trans_info, trimap) and returns: alpha