def resize_bbox_list(label_list, img_w, img_h, outp_img_size):
    """
    Resizes a list of bboxes to the desired output size. If an image is resized, should also the corresponding bboxes be
    resized. The img_w and img_h specify the original image size. Outp_img_size specifies the image size after resizing.
    :param label_list: list of bboxes in format [[[x,y,width,height], bbox_category_id], ...]
    :param img_w: input width of bboxes. This is the original size of the image for which the bbox list is meant.
    :param img_h: input height of bboxes. This is the original size of the image for which the bbox list is meant.
    :param outp_img_size: output size in format (width, height). This is the image size after resizing.
    :return: list of resized bboxes in format [[[x,y,width,height], bbox_category_id], ...]
    """
    resize_factor_x = outp_img_size[0] / img_w
    resize_factor_y = outp_img_size[1] / img_h

    resize_label = []
    for bbox, category in label_list:
        resize_label.append([[bbox[0] * resize_factor_x, bbox[1] * resize_factor_y, bbox[2] * resize_factor_x,
                              bbox[3] * resize_factor_y], category])
    return resize_label