def x1y1x2y2_to_x1y1wh(bbox):
    """Convert [x1,y1,x2,y2] bounding box to a [x,y,w,h] 
    bounding box"""
    assert len(bbox)==4
    assert bbox[0] <= bbox[2] and bbox[1] <= bbox[3]
    return [bbox[0], bbox[1], bbox[2]-bbox[0], bbox[3]-bbox[1]]