code: def aggregate_wbg(prob, keep_bg=False, hard=False):
      k, _, h, w = prob.shape
      new_prob = paddle.concat(
          [paddle.prod(1 - prob, axis=0, keepdim=True), prob], 0
      ).clip(1e-7, 1 - 1e-7)
      logits = paddle.log((new_prob / (1 - new_prob)))
  
      if hard:
          logits *= 1000
  
      if keep_bg:
          return F.softmax(logits, axis=0)
      else:
          return F.softmax(logits, axis=0)[1:]
  
file_path: PaddleSeg/EISeg/eiseg/plugin/video/video_tools.py
imports: import glob
  import os
  import cv2
  import numpy
  import paddle
  import paddle.nn.functional
  from PIL import Image
  from eiseg.util.vis import get_palette
label_desc: Use image node_id 4 for calling a global function with example usage: aggregate_wbg(prob, keep_bg, hard) and returns: F, F