abdc942ed5132a915ca6fccc13470bdf730f1457,test/augmenters/test_color.py,,test_Grayscale,#,87

Before Change


    aug = iaa.Grayscale((0.0, 1.0))
    base_img = base_img[0:1, 0:1, :]
    base_img_gray = iaa.Grayscale(1.0).augment_image(base_img)
    distance_max = np.average(np.abs(base_img_gray.astype(np.int32) - base_img.astype(np.int32)))
    nb_iterations = 1000
    distances = []
    for _ in sm.xrange(nb_iterations):

After Change


    assert np.allclose(observed, expected.astype(np.uint8))

    aug = iaa.Grayscale((0.0, 1.0))
    base_img = np.uint8([255, 0, 0]).reshape((1, 1, 3))
    base_img_float = base_img.astype(np.float64) / 255.0
    base_img_gray = iaa.Grayscale(1.0).augment_image(base_img).astype(np.float64) / 255.0
    distance_max = np.linalg.norm(base_img_gray.flatten() - base_img_float.flatten())
    nb_iterations = 1000
    distances = []
    for _ in sm.xrange(nb_iterations):
        observed = aug.augment_image(base_img).astype(np.float64) / 255.0
        distance = np.linalg.norm(observed.flatten() - base_img_float.flatten()) / distance_max
        distances.append(distance)

    assert 0 - 1e-4 < min(distances) < 0.1
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: aleju/imgaug
Commit Name: abdc942ed5132a915ca6fccc13470bdf730f1457
Time: 2019-01-28
Author: kontakt@ajung.name
File Name: test/augmenters/test_color.py
Class Name:
Method Name: test_Grayscale


Project Name: aleju/imgaug
Commit Name: abdc942ed5132a915ca6fccc13470bdf730f1457
Time: 2019-01-28
Author: kontakt@ajung.name
File Name: test/augmenters/test_color.py
Class Name:
Method Name: test_Grayscale


Project Name: glm-tools/pyglmnet
Commit Name: a68ad3bda020d9ade2b33c58a3f1406de41b682c
Time: 2018-09-05
Author: pavan.ramkumar@gmail.com
File Name: pyglmnet/pyglmnet.py
Class Name: GLM
Method Name: fit


Project Name: glm-tools/pyglmnet
Commit Name: 4367785c9131771d2dd80b45d4bbb4ca00bd24ac
Time: 2018-09-08
Author: pavan.ramkumar@gmail.com
File Name: pyglmnet/pyglmnet.py
Class Name: GLM
Method Name: fit