docstr: API for human video segmentation.
  
  Args:
     frame_org (numpy.ndarray): frame data, shape of each is [H, W, C], the color space is BGR.
     frame_id (int): index of the frame to be decoded.
     prev_gray (numpy.ndarray): gray scale image of last frame, shape of each is [H, W]
     prev_cfd (numpy.ndarray): fusion image from optical flow image and segment result, shape of each is [H, W]
     use_gpu (bool): Whether to use gpu.
  
  Returns:
      img_matting (numpy.ndarray): data of segmentation mask.
      cur_gray (numpy.ndarray): gray scale image of current frame, shape of each is [H, W]
      optflow_map (numpy.ndarray): optical flow image of current frame, shape of each is [H, W]
docstr_tok: ["API","for","human","video","segmentation",".","Args",":","frame_org","(","numpy.ndarray",")",":","frame","data",",","shape","of","each","is","[","H",",","W",",","C","]",",","the","color","space","is","BGR",".","frame_id","(","int",")",":","index","of","the","frame","to","be","decoded",".","prev_gray","(","numpy.ndarray",")",":","gray","scale","image","of","last","frame",",","shape","of","each","is","[","H",",","W","]","prev_cfd","(","numpy.ndarray",")",":","fusion","image","from","optical","flow","image","and","segment","result",",","shape","of","each","is","[","H",",","W","]","use_gpu","(","bool",")",":","Whether","to","use","gpu",".","Returns",":","img_matting","(","numpy.ndarray",")",":","data","of","segmentation","mask",".","cur_gray","(","numpy.ndarray",")",":","gray","scale","image","of","current","frame",",","shape","of","each","is","[","H",",","W","]","optflow_map","(","numpy.ndarray",")",":","optical","flow","image","of","current","frame",",","shape","of","each","is","[","H",",","W","]"]
code: def video_stream_segment(
      self, frame_org, frame_id, prev_gray, prev_cfd, use_gpu=False
  ):
      """
      API for human video segmentation.
  
      Args:
         frame_org (numpy.ndarray): frame data, shape of each is [H, W, C], the color space is BGR.
         frame_id (int): index of the frame to be decoded.
         prev_gray (numpy.ndarray): gray scale image of last frame, shape of each is [H, W]
         prev_cfd (numpy.ndarray): fusion image from optical flow image and segment result, shape of each is [H, W]
         use_gpu (bool): Whether to use gpu.
  
      Returns:
          img_matting (numpy.ndarray): data of segmentation mask.
          cur_gray (numpy.ndarray): gray scale image of current frame, shape of each is [H, W]
          optflow_map (numpy.ndarray): optical flow image of current frame, shape of each is [H, W]
  
      """
      resize_h = 192
      resize_w = 192
      is_init = True
      width = int(frame_org.shape[0])
      height = int(frame_org.shape[1])
      disflow = cv2.DISOpticalFlow_create(
          cv2.DISOPTICAL_FLOW_PRESET_ULTRAFAST
      )
      frame = preprocess_v(frame_org, resize_w, resize_h)
  
      predictor = self.gpu_predictor if use_gpu else self.cpu_predictor
      input_names = predictor.get_input_names()
      input_handle = predictor.get_input_handle(input_names[0])
      input_handle.copy_from_cpu(frame.copy()[None, ...])
      predictor.run()
      output_names = predictor.get_output_names()
      output_handle = predictor.get_output_handle(output_names[1])
      score_map = output_handle.copy_to_cpu()
  
      frame = np.transpose(frame, axes=[1, 2, 0])
      score_map = np.transpose(np.squeeze(score_map, 0), axes=[1, 2, 0])
      cur_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      cur_gray = cv2.resize(cur_gray, (resize_w, resize_h))
      score_map = 255 * score_map[:, :, 1]
      if frame_id == 1:
          prev_gray = np.zeros((resize_h, resize_w), np.uint8)
          prev_cfd = np.zeros((resize_h, resize_w), np.float32)
          optflow_map = postprocess_v(
              cur_gray, score_map, prev_gray, prev_cfd, disflow, is_init
          )
      else:
          optflow_map = postprocess_v(
              cur_gray, score_map, prev_gray, prev_cfd, disflow, is_init
          )
  
      optflow_map = cv2.GaussianBlur(optflow_map, (3, 3), 0)
      optflow_map = threshold_mask(
          optflow_map, thresh_bg=0.2, thresh_fg=0.8
      )
      img_matting = cv2.resize(
          optflow_map, (height, width), cv2.INTER_LINEAR
      )
  
      return [img_matting, cur_gray, optflow_map]
  
imports: import argparse
  import ast
  import os
  import os.path
  import cv2
  import numpy
  import paddle.jit
  import paddle.static
  from paddle.inference import Config
  from paddle.inference import create_predictor
  from .data_feed import preprocess_v
  from .data_feed import reader
  from .optimal import postprocess_v
  from .optimal import threshold_mask
  from .processor import base64_to_cv2
  from .processor import check_dir
  from .processor import cv2_to_base64
  from .processor import postprocess
  from paddlehub.module.module import moduleinfo
  from paddlehub.module.module import runnable
  from paddlehub.module.module import serving
label_desc: Use image node_id 4 for calling the ShufflenetHumanSeg obj's underlying member method code with example usage: obj.video_stream_segment(frame_org, frame_id, prev_gray, prev_cfd, use_gpu) and returns: list