def increase_bbox(bbox, scale, image_size, type='xyhw'):
    """Increase the size of the bounding box
    Input:
        bbox_xywh:
        scale:
        image_size: tuple of int, (h, w)
        type (string): notation of bbox: 'xyhw' or 'xyx2y2'
    """
    if type == 'xyhw':
        x1, y1, bbox_w, bbox_h = bbox
        x2 = x1 + bbox_w
        y2 = y1 + bbox_h
    else:
        x1, y1, x2, y2 = bbox
        bbox_h = y2 - y1
        bbox_w = x2 - x1
    h, w = image_size

    increase_w_by = (bbox_w * scale - bbox_w) // 2
    increase_h_by = (bbox_h * scale - bbox_h) // 2

    new_x1 = int(max(0, x1 - increase_w_by))
    new_x2 = int(min(w - 1, x2 + increase_w_by))

    new_y1 = int(max(0, y1 - increase_h_by))
    new_y2 = int(min(h - 1, y2 + increase_h_by))

    if type == 'xyhw':
        return (new_x1, new_y1, new_x2 - new_x1, new_y2 - new_y1)
    else:
        return (new_x1, new_y1, new_x2, new_y2)