def random_flip(img_list, box_list, h_prob=0.5, v_prob=None):
    if (h_prob and (random.random() < h_prob)):
        new_img = F.hflip(img_list.img)
        img_list.img = new_img
        assert (img_list.resized_size == box_list.img_size), 'img size != box size when flipping.'
        box_list.box_flip(method='h_flip')
    if (v_prob and (random.random() < v_prob)):
        raise NotImplementedError('Vertical flip has not been implemented.')
    return (img_list, box_list)
def random_flip(img_list, box_list, h_prob=0.5, v_prob=None):
    if (h_prob and (random.random() < h_prob)):
        new_img = F.hflip(img_list.img)
        img_list.img = new_img
        assert (img_list.resized_size == box_list.img_size), 'img size != box size when flipping.'
        box_list.box_flip(method='h_flip')
    if (v_prob and (random.random() < v_prob)):
        raise NotImplementedError('Vertical flip has not been implemented.')
    return (img_list, box_list)