def load_bounding_boxes(path, switch_order=True):
    """
    Returns a dict {filename: [x1, y1, x2, y2]} given path to
    DeepFashion bbox file. Each x and y are swapped if switch_order.
    """
    bboxes = {}
    with open(path, 'r') as ff:
        num_boxes = ff.readline()
        num_boxes = int(num_boxes)
        fields = ff.readline()
        for ii, line in enumerate(ff):
            imname, clothes_type, source_type, x1, y1, x2, y2 = line.strip().split()
            if switch_order:
                # TensorFlow wants height, width
                box = [y1, x1, y2, x2]
            else:
                box = [x1, y1, x2, y2]
            bboxes[imname] = [int(xx) for xx in box]
    assert len(bboxes) == num_boxes
    return bboxes