我最近开始玩 keras 和 vgg16,我正在使用 keras.applications.vgg16。
但是在这里我提出了一个问题,model.inputs因为我看到其他人在https://github.com/keras-team/keras/blob/master/examples/conv_filter_visualization.py 中使用它,尽管它没有初始化它
...
input_img = model.input
...
layer_output = layer_dict[layer_name].output
if K.image_data_format() == 'channels_first':
loss = K.mean(layer_output[:, filter_index, :, :])
else:
loss = K.mean(layer_output[:, :, :, filter_index])
# we compute the gradient of the input picture wrt this loss
grads = K.gradients(loss, input_img)[0]
Run Code Online (Sandbox Code Playgroud)
我检查了 keras 站点,但它只说这是一个形状为 (1,224,224,3) 的输入张量,但我仍然不明白那到底是什么。那是来自 ImageNet 的图像吗?还是由 keras 为 keras 模型提供的默认图像?
如果我对深度学习没有足够的了解,我很抱歉,但有人可以向我解释一下。谢谢