FileNotFoundError:[WinError 3]系统找不到指定的路径:'/tmp/o7knflub.h5'

时间:2019-12-05 09:40:16

标签: python tensorflow keras

我的代码是:
    从vis.visualization导入visualize_saliency     从vis.utils导入utils     从keras导入激活     从matplotlib导入pyplot作为plt     %matplotlib内联

class_idx = 0
indices = np.where(y_test[:, class_idx] == 1.)[0]

# pick some random input from here.
idx = indices[0]

# Utility to search for layer index by name. 
# Alternatively we can specify this as -1 since it corresponds to the last layer.
layer_idx = utils.find_layer_idx(model, 'preds')

# Swap softmax with linear
model.layers[layer_idx].activation = activations.linear
model = utils.apply_modifications(model)

grads = visualize_saliency(model, layer_idx, filter_indices=class_idx, 
seed_input=x_test[idx])
# Plot with 'jet' colormap to visualize as a heatmap.
plt.imshow(grads, cmap='jet')

0 个答案:

没有答案