4e8a831d2a4f4ce8d80c25d43c614255237da71a,examples/attention_maps.py,,generate_cam,#,30

Before Change


    layer_name = "predictions"
    layer_idx = [idx for idx, layer in enumerate(model.layers) if layer.name == layer_name][0]

    for path in ["../resources/ouzel.jpg", "../resources/ouzel_1.jpg"]:
        seed_img = utils.load_img(path, target_size=(224, 224))
        // 20 is the imagenet category for "ouzel"
        heatmap = visualize_cam(model, layer_idx, [20], seed_img)

After Change



    for path in ["https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Tigerwater_edit2.jpg/170px-Tigerwater_edit2.jpg"]:
        seed_img = utils.load_img(path, target_size=(224, 224))
        pred_class = np.argmax(model.predict(np.array([img_to_array(seed_img)])))
        heatmap = visualize_cam(model, layer_idx, [pred_class], seed_img)
        cv2.imshow("Attention - {}".format(utils.get_imagenet_label(pred_class)), heatmap)
        cv2.waitKey(0)

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: raghakot/keras-vis
Commit Name: 4e8a831d2a4f4ce8d80c25d43c614255237da71a
Time: 2016-12-24
Author: ragha@outlook.com
File Name: examples/attention_maps.py
Class Name:
Method Name: generate_cam


Project Name: raghakot/keras-vis
Commit Name: 5ee8d4a1719a4c1070924351af9c2119432e7066
Time: 2017-04-29
Author: ragha@outlook.com
File Name: examples/attention_maps.py
Class Name:
Method Name: generate_saliceny_map


Project Name: raghakot/keras-vis
Commit Name: 5ee8d4a1719a4c1070924351af9c2119432e7066
Time: 2017-04-29
Author: ragha@outlook.com
File Name: examples/attention_maps.py
Class Name:
Method Name: generate_cam


Project Name: raghakot/keras-vis
Commit Name: 4e8a831d2a4f4ce8d80c25d43c614255237da71a
Time: 2016-12-24
Author: ragha@outlook.com
File Name: examples/attention_maps.py
Class Name:
Method Name: generate_saliceny_map