Skip to content

Commit

Permalink
Delete __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
raghakot committed Jul 6, 2017
1 parent 514b7f7 commit 41d503b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions applications/audio/visualize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import numpy as np
from keras.models import load_model
from vis.visualization import visualize_cam, visualize_saliency
from vis.utils import utils

from matplotlib import pyplot as plt
from keras import backend as K

K.set_image_data_format('channels_first')
seed_input = np.load('input.npy')
model = load_model('2017_06_22_00_36_17_model.h5')

pred_class = 4
penultimate_idx = utils.find_layer_idx(model, 'bidirectional_2')
heatmap_weak = visualize_saliency(model, utils.find_layer_idx(model, 'weak_out'),
pred_class, seed_input, backprop_modifier='deconv')

heatmap_strong = visualize_saliency(model, utils.find_layer_idx(model, 'strong_out'),
pred_class, seed_input, backprop_modifier='deconv')

plt.figure()
plt.subplot(311)
plt.imshow(np.transpose(heatmap_strong, (1, 0, 2)), aspect='auto', origin='lower')

plt.subplot(312)
plt.imshow(np.transpose(heatmap_weak, (1, 0, 2)), aspect='auto', origin='lower')

plt.subplot(313)
plt.imshow(seed_input[0].T, aspect='auto', origin='lower')
plt.show()
Empty file removed examples/__init__.py
Empty file.

0 comments on commit 41d503b

Please sign in to comment.