bdf2142281710cba0154bc5d63b3e8c55486509d,test/augmentables/test_polys.py,Test_ConcavePolygonRecoverer,test__fit_best_valid_polygon,#Test_ConcavePolygonRecoverer#,2267

Before Change



        cpr = _ConcavePolygonRecoverer()
        points = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)]
        points_fit = cpr._fit_best_valid_polygon(points, random_state=np.random.RandomState(0))
        // doing this without the list(.) wrappers fails on python2.7
        assert list(points_fit) == list(sm.xrange(len(points)))

        // square-like, but top line has one point in its center which"s
        // y-coordinate is below the bottom line
        points = [(0.0, 0.0), (0.45, 0.0), (0.5, 1.5), (0.55, 0.0), (1.0, 0.0),
                  (1.0, 1.0), (0.0, 1.0)]
        points_fit = cpr._fit_best_valid_polygon(points, random_state=np.random.RandomState(0))
        _assert_ids_match(points_fit, [0, 1, 3, 4, 5, 2, 6])
        assert ia.Polygon([points[idx] for idx in points_fit]).is_valid

        // |--|  |--|
        // |  |  |  |
        // |  |  |  |
        // |--|--|--|
        //    |  |
        //    ----
        // the intersection points on the bottom line are not provided,
        // hence the result is expected to have triangles at the bottom left
        // and right
        points = [(0.0, 0), (0.25, 0), (0.25, 1.25),
                  (0.75, 1.25), (0.75, 0), (1.0, 0),
                  (1.0, 1.0), (0.0, 1.0)]
        points_fit = cpr._fit_best_valid_polygon(points, random_state=np.random.RandomState(0))
        _assert_ids_match(points_fit, [0, 1, 4, 5, 6, 3, 2, 7])
        poly_observed = ia.Polygon([points[idx] for idx in points_fit])
        assert poly_observed.is_valid

        // same as above, but intersection points at the bottom line are provided
        // without oversampling, i.e. incorporating these points would lead to an
        // invalid polygon
        points = [(0.0, 0), (0.25, 0), (0.25, 1.0), (0.25, 1.25),
                  (0.75, 1.25), (0.75, 1.0), (0.75, 0), (1.0, 0),
                  (1.0, 1.0), (0.0, 1.0)]
        points_fit = cpr._fit_best_valid_polygon(points, random_state=np.random.RandomState(0))
        assert len(points_fit) >= len(points) - 2  // TODO add IoU check here
        poly_observed = ia.Polygon([points[idx] for idx in points_fit])
        assert poly_observed.is_valid

After Change


                "count mismatch: %d vs %d" % (max_count, len(expected)))

        cpr = _ConcavePolygonRecoverer()
        rng = iarandom.RNG(0)

        points = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)]
        points_fit = cpr._fit_best_valid_polygon(
            points, random_state=rng.copy())
        // doing this without the list(.) wrappers fails on python2.7
        assert list(points_fit) == list(sm.xrange(len(points)))

        // square-like, but top line has one point in its center which"s
        // y-coordinate is below the bottom line
        points = [(0.0, 0.0), (0.45, 0.0), (0.5, 1.5), (0.55, 0.0), (1.0, 0.0),
                  (1.0, 1.0), (0.0, 1.0)]
        points_fit = cpr._fit_best_valid_polygon(
            points, random_state=rng.copy())
        _assert_ids_match(points_fit, [0, 1, 3, 4, 5, 2, 6])
        assert ia.Polygon([points[idx] for idx in points_fit]).is_valid

        // |--|  |--|
        // |  |  |  |
        // |  |  |  |
        // |--|--|--|
        //    |  |
        //    ----
        // the intersection points on the bottom line are not provided,
        // hence the result is expected to have triangles at the bottom left
        // and right
        points = [(0.0, 0), (0.25, 0), (0.25, 1.25),
                  (0.75, 1.25), (0.75, 0), (1.0, 0),
                  (1.0, 1.0), (0.0, 1.0)]
        points_fit = cpr._fit_best_valid_polygon(
            points, random_state=rng.copy())
        _assert_ids_match(points_fit, [0, 1, 4, 5, 6, 3, 2, 7])
        poly_observed = ia.Polygon([points[idx] for idx in points_fit])
        assert poly_observed.is_valid

        // same as above, but intersection points at the bottom line are
        // provided without oversampling, i.e. incorporating these points
        // would lead to an invalid polygon
        points = [(0.0, 0), (0.25, 0), (0.25, 1.0), (0.25, 1.25),
                  (0.75, 1.25), (0.75, 1.0), (0.75, 0), (1.0, 0),
                  (1.0, 1.0), (0.0, 1.0)]
        points_fit = cpr._fit_best_valid_polygon(
            points, random_state=rng.copy())
        assert len(points_fit) >= len(points) - 2  // TODO add IoU check here
        poly_observed = ia.Polygon([points[idx] for idx in points_fit])
        assert poly_observed.is_valid
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 19

Instances


Project Name: aleju/imgaug
Commit Name: bdf2142281710cba0154bc5d63b3e8c55486509d
Time: 2019-08-30
Author: kontakt@ajung.name
File Name: test/augmentables/test_polys.py
Class Name: Test_ConcavePolygonRecoverer
Method Name: test__fit_best_valid_polygon


Project Name: aleju/imgaug
Commit Name: bdf2142281710cba0154bc5d63b3e8c55486509d
Time: 2019-08-30
Author: kontakt@ajung.name
File Name: test/augmentables/test_polys.py
Class Name: Test_ConcavePolygonRecoverer
Method Name: test__jitter_duplicate_points


Project Name: aleju/imgaug
Commit Name: bdf2142281710cba0154bc5d63b3e8c55486509d
Time: 2019-08-30
Author: kontakt@ajung.name
File Name: test/augmentables/test_polys.py
Class Name: Test_ConcavePolygonRecoverer
Method Name: test__fix_polygon_is_line