70e4855f5608c4481dfffd5f762e310d631d06c3,test_model_CAM.py,,returnCAM,#Any#Any#Any#,45

Before Change


    nc, h, w = feature_conv.shape
    output_cam = []
    for idx in class_idx:
        cam = weight_softmax[class_idx].dot(feature_conv.reshape((nc, h*w)))
        cam = cam.reshape(h, w)
        cam = cam - np.min(cam)
        cam_img = cam / np.max(cam)
        cam_img = np.uint8(255 * cam_img)
        output_cam.append(imresize(cam_img, size_upsample))
    return output_cam

After Change


    for idx in class_idx:
        cam = (weight_softmax[class_idx]@feature_conv.view(nc, h*w))
        cam.add_(-cam.min()).div_(cam.max()).mul_(255)
        cam = F.interpolate(cam.view(1,1,h,w), size=size_upsample, mode="bilinear",
                            align_corners=False).squeeze()
        cam = np.uint8(cam.numpy())
        output_cam.append(cam)
    return output_cam

def returnTF():
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: metalbubble/moments_models
Commit Name: 70e4855f5608c4481dfffd5f762e310d631d06c3
Time: 2020-10-09
Author: mmonfort@mit.edu
File Name: test_model_CAM.py
Class Name:
Method Name: returnCAM


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: lanpa/tensorboardX
Commit Name: 9e945725a4cfada7c9dc3688d567a7909c866687
Time: 2019-01-20
Author: huang.dexter@gmail.com
File Name: tensorboardX/embedding.py
Class Name:
Method Name: make_sprite