Esempio n. 1
0
    def test_anchor_boxes(self):
        ret = Bboxer.anchor_boxes()

        for i in range(len(FEATURE_MAPS)):
            grid_size = FEATURE_MAPS[i]
            for j, aspect_ratio in enumerate(Bboxer.aspect_ratios(grid_size)):
                print(i, j)
                self.assert_arr_equals(
                    ret[i][j], Bboxer.anchor_corners(grid_size, aspect_ratio))
Esempio n. 2
0
    def test_anchor_corners_for_aspect_ratio(self):
        raw_ret = [[-0.125, 0., 0.375, 0.25], [-0.125, 0.25, 0.375, 0.5],
                   [-0.125, 0.5, 0.375, 0.75], [-0.125, 0.75, 0.375, 1.],
                   [0.125, 0., 0.625, 0.25], [0.125, 0.25, 0.625, 0.5],
                   [0.125, 0.5, 0.625, 0.75], [0.125, 0.75, 0.625, 1.],
                   [0.375, 0., 0.875, 0.25], [0.375, 0.25, 0.875, 0.5],
                   [0.375, 0.5, 0.875, 0.75], [0.375, 0.75, 0.875, 1.],
                   [0.625, 0., 1.125, 0.25], [0.625, 0.25, 1.125, 0.5],
                   [0.625, 0.5, 1.125, 0.75], [0.625, 0.75, 1.125, 1.]]

        ret = Bboxer.anchor_corners(grid_size=4, aspect_ratio=(2., 1.))

        self.assert_arr_equals(ret, raw_ret)
Esempio n. 3
0
    def test_anchor_corners(self):
        raw_ret = [[0.0000, 0.0000, 0.2500, 0.2500],
                   [0.0000, 0.2500, 0.2500, 0.5000],
                   [0.0000, 0.5000, 0.2500, 0.7500],
                   [0.0000, 0.7500, 0.2500, 1.0000],
                   [0.2500, 0.0000, 0.5000, 0.2500],
                   [0.2500, 0.2500, 0.5000, 0.5000],
                   [0.2500, 0.5000, 0.5000, 0.7500],
                   [0.2500, 0.7500, 0.5000, 1.0000],
                   [0.5000, 0.0000, 0.7500, 0.2500],
                   [0.5000, 0.2500, 0.7500, 0.5000],
                   [0.5000, 0.5000, 0.7500, 0.7500],
                   [0.5000, 0.7500, 0.7500, 1.0000],
                   [0.7500, 0.0000, 1.0000, 0.2500],
                   [0.7500, 0.2500, 1.0000, 0.5000],
                   [0.7500, 0.5000, 1.0000, 0.7500],
                   [0.7500, 0.7500, 1.0000, 1.0000]]

        ret = Bboxer.anchor_corners(grid_size=4)

        self.assert_arr_equals(ret, raw_ret)