Я пытаюсь визуализировать слои сверточных и капсульных сетей.Код для визуализации выглядит следующим образом:
layer_outputs = [layer.get_output_at(0) for layer in model.layers[:12]# Extracts the outputs of the top 12 layers
activation_model = models.Model(inputs=model.input, outputs=output_layer) # Creates a model that will return these outputs, given the model input
activations = activation_model.predict(img_tensor)
здесь img_tensor является массивом формы (1,28,28,1).Изображение из набора данных mnist.Выполнение кода выдает ошибку следующим образом:
ValueError: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 2 array(s), but instead got the following list of 1 arrays: [array([[[[0.0000000e+00],
[0.0000000e+00],
[0.0000000e+00],
[0.0000000e+00],
[0.0000000e+00],
[0.0000000e+00],
[0.0000000e+00],
[0.00000...
Ошибка возникает из-за строки activations = activation_model.predict(img_tensor)
.
Может кто-нибудь знает, почему это происходит?