code: def _paste_mask(box, mask, shape):
      
      # int() is floor
      # box fpcoor=0.0 -> intcoor=0.0
      x0, y0 = list(map(int, box[:2] + 0.5))
      # box fpcoor=h -> intcoor=h-1, inclusive
      x1, y1 = list(map(int, box[2:] - 0.5))    # inclusive
      x1 = max(x0, x1)    # require at least 1x1
      y1 = max(y0, y1)
  
      w = x1 + 1 - x0
      h = y1 + 1 - y0
  
      # rounding errors could happen here, because masks were not originally computed for this shape.
      # but it's hard to do better, because the network does not know the "original" scale
      mask = (cv2.resize(mask, (w, h)) > 0.5).astype('uint8')
      ret = np.zeros(shape, dtype='uint8')
      ret[y0:y1 + 1, x0:x1 + 1] = mask
      return ret
docs: Args:
          box: 4 float
          mask: MxM floats
          shape: h,w
      Returns:
          A uint8 binary image of hxw.