3a25edce742db97d936ffb645185b520878d0c6d,dataset/resize.py,ImagenetResizer,resize_img,#ImagenetResizer#,23

Before Change


        width, height = img.size
        aspect_ratio = width / height
        if width <= height & width < size[0]:
            cover = img.resize((size[0], math.floor(size[0] / aspect_ratio)))
        elif width >= height & height < size[1]:
            cover = img.resize((size[1], math.floor(size[1] * aspect_ratio)))
        else:
            cover = resizeimage.resize_contain(img, size)

After Change


            // so take the side that"s closer in size and enlarge the image
            // in both directions to make that one fit
            factor = min(ratio_h, ratio_w)
            img = img.resize((int(width * factor), int(height * factor)))

        // Now we have an image that"s either larger than the desired shape
        // or at least one side matches the desired shape and we can resize
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: baldassarreFe/deep-koalarization
Commit Name: 3a25edce742db97d936ffb645185b520878d0c6d
Time: 2017-05-06
Author: baldassarre.fe@gmail.com
File Name: dataset/resize.py
Class Name: ImagenetResizer
Method Name: resize_img


Project Name: utkuozbulak/pytorch-cnn-visualizations
Commit Name: ada2c33261b3273822557a7aff8bbf11d309fac1
Time: 2018-11-17
Author: utku.ozbulak@gmail.com
File Name: src/misc_functions.py
Class Name:
Method Name: preprocess_image


Project Name: utkuozbulak/pytorch-cnn-visualizations
Commit Name: 818b177b0d10394c1fd1c75465ff55aabadb221b
Time: 2018-12-30
Author: utku.ozbulak@gmail.com
File Name: src/gradcam.py
Class Name: GradCam
Method Name: generate_cam