def test_convert_to_and_fro_with_array(): bb1 = np.array([139., 200., 69., 102.]) bb2 = np.array([139., 200., 69., 51.]) bb3 = np.array([239., 300., 69., 51.]) bb = np.vstack((bb1, bb2, bb3)) bb = np.tile(bb, (100000, 1)) print(bb.shape) tt = TicToc().tic() bb_c = BoundingBox.convert_arr_to_corners(bb) tt.toc() print(bb_c.shape) tt.tic() bb2 = BoundingBox.convert_arr_from_corners(bb_c) tt.toc() print(bb2.shape) assert(np.all(bb == bb2))
def test_convert_to_and_fro(): bb = np.array([139., 200., 69., 102.]) bb_c = BoundingBox.convert_arr_to_corners(bb) bb2 = BoundingBox.convert_arr_from_corners(bb_c) assert(np.all(bb == bb2))