818b177b0d10394c1fd1c75465ff55aabadb221b,src/gradcam.py,GradCam,generate_cam,#GradCam#Any#Any#,59

Before Change


        // Multiply each weight with its conv output and then, sum
        for i, w in enumerate(weights):
            cam += w * target[i, :, :]
        cam = cv2.resize(cam, (224, 224))
        cam = np.maximum(cam, 0)
        cam = (cam - np.min(cam)) / (np.max(cam) - np.min(cam))  // Normalize between 0-1
        cam = np.uint8(cam * 255)  // Scale between 0-255 to visualize
        return cam

After Change


        cam = np.maximum(cam, 0)
        cam = (cam - np.min(cam)) / (np.max(cam) - np.min(cam))  // Normalize between 0-1
        cam = np.uint8(cam * 255)  // Scale between 0-255 to visualize
        cam = np.uint8(Image.fromarray(cam).resize((input_image.shape[2],
                       input_image.shape[3]), Image.ANTIALIAS))
        // ^ I am extremely unhappy with this line. Originally resizing was done in cv2 which
        // supports resizing numpy matrices, however, when I moved the repository to PIL, this
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


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


Project Name: scikit-image/scikit-image
Commit Name: ed8539bc74d05675df666397be4902fa9cfb92a1
Time: 2017-09-20
Author: jsch@demuc.de
File Name: doc/examples/transform/plot_rescale.py
Class Name:
Method Name:


Project Name: pliablepixels/zmeventnotification
Commit Name: 2303bad77ae5f16e9d87ef6dd2427b39e2fa1670
Time: 2019-03-02
Author: pliablepixels@gmail.com
File Name: hook/zmes_hook_helpers/face.py
Class Name: Face
Method Name: detect