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


    if params.channel_axis != 2:
        image = np.moveaxis(image, params.channel_axis, 2)

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

    if params.channel_axis != 2:
        output = np.moveaxis(output, 2, params.channel_axis)
    return output


def resize_image(img, min_side=600, max_side=1024):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

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: data61/python-paillier
Commit Name: eb4ffb6cdaf6f04f978fc57e32c95c8b4a33bcb6
Time: 2017-06-20
Author: giorgio.patrini@anu.edu.au
File Name: examples/federated_learning_with_encryption.py
Class Name: Client
Method Name: fit


Project Name: geomstats/geomstats
Commit Name: b0d0053b1f1738640fc99fba642c83af42d10b22
Time: 2018-02-02
Author: ninamio78@gmail.com
File Name: geomstats/invariant_metric.py
Class Name: InvariantMetric
Method Name: inner_product_matrix