def bbox_to_wandb_dict(xyxy_bbox, class_id, class_id_to_label, image_shape, scores=None):
    """Converts provided variables to wandb bbox-visualization format.

    Args:
        xyxy_bbox: a tensor of size (4,) following the XYXY format (x1, y1, x2, y2)
        class_id: int, predicted or actual class for the bbox
        class_id_to_label: dict, mapping from class_id to class name
        image_shape: shape of the image to calculate the scaled coordinates
        scores (Optional): dict, additional values to attach to the bbox
    Returns:
        dict following wandb format. See
        https://docs.wandb.ai/guides/track/log#images-and-overlays and
        https://medium.com/analytics-vidhya/object-localization-with-keras-2f272f79e03c
    """

    caption = class_id_to_label[class_id]
    if scores is not None and "prob" in scores:
        prob = int(round(scores["prob"] * 100))
        caption = f"{caption} {prob}%"
    d = {
        "position": {
            "minX": xyxy_bbox[0].item() / image_shape[1],
            "maxX": xyxy_bbox[2].item() / image_shape[1],
            "minY": xyxy_bbox[1].item() / image_shape[0],
            "maxY": xyxy_bbox[3].item() / image_shape[0],
        },
        "class_id": class_id,
        "box_caption": caption,
    }
    if scores:
        d["scores"] = scores
    return d