985995460466aecec6adbe282c98ebff68749fa6,keras_retinanet/utils/image.py,,apply_transform,#Any#Any#Any#,107

Before Change


    // which is opposite of what you would normally expect.
    // So we invert the transformation before passing it to scipy.
    // Otherwise, a scaling of (3, 3) would actually shrink the image contents by a factor 3.
    matrix = np.linalg.inv(matrix)

    // Scipy also has the origin of linear transformations at the *center* of pixel (0, 0).
    // We need to adjust, because that"s insane.
    // We want the origin precisely at the top left corner of the image.
    matrix = change_transform_origin(matrix, (-0.5, -0.5))

    // The first axis of an image stored as numpy array is the Y axis.
    // The matrix has to be adjusted to match that convention.
    matrix[:2, :2] = matrix[1::-1, 1::-1]
    matrix[:2,  2] = matrix[1::-1, 2]

    // Apply the transformation to each channel separately.
    // For that we need the first axis to represent the channels so we can loop over them.
    image    = np.moveaxis(image, params.channel_axis, 0)

After Change


    output = cv2.warpAffine(
        image,
        matrix[:2, :],
        dsize       = (image.shape[1], image.shape[0]),
        flags       = params.cvInterpolation(),
        borderMode  = params.cvBorderMode(),
        borderValue = params.cval,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: fizyr/keras-retinanet
Commit Name: 985995460466aecec6adbe282c98ebff68749fa6
Time: 2018-01-30
Author: maarten@de-vri.es
File Name: keras_retinanet/utils/image.py
Class Name:
Method Name: apply_transform


Project Name: geomstats/geomstats
Commit Name: aba65f959fb114e67103a061e92ab5596c557d3d
Time: 2018-12-27
Author: ninamio78@gmail.com
File Name: geomstats/lie_group.py
Class Name: LieGroup
Method Name: group_exp


Project Name: stellargraph/stellargraph
Commit Name: ce597a0b10658043b6d6d8ffed3fff4a6ebbc1ea
Time: 2019-09-26
Author: u5824685@anu.edu.au
File Name: stellargraph/layer/ppnp.py
Class Name: PPNP
Method Name: __init__