Я обучил модель InceptionResnetV2 для выполнения задачи 4 классификации моих изображений в кератах.Теперь мне нужно пройти тестовое изображение через обученную модель, чтобы увидеть, какие особенности были фактически изучены моей моделью.Я намерен визуализировать до последнего слоя, но я начал с первых 12 слоев, следуя учебнику this .
Когда я вызываю слой активации моей модели для визуализации, я получаю аргументошибка
tenorflow.python.framework.errors_impl.InvalidArgumentError: Нет такого вызываемого дескриптора: 6490197728, который сообщает tenorflow.python.framework.errors_impl.InvalidArgumentError: input_1: 0 загружается и извлекается.
что мне не хватает
вот мои коды
from keras.preprocessing import image
from tensorflow.keras.models import Model
import numpy as np
import tensorflow as tf
img_path='../../../data/fourclasses/class_label/205.jpg'
img = image.load_img(img_path, target_size=(299, 299))
img = image.img_to_array(img)
img = np.expand_dims(img, axis=0)
img /= 255.
new_model=tf.keras.models.load_model('test_model.model')
predictions=new_model.predict(img)
print(predictions)
label = np.argmax(predictions, axis=1)
print(label)
# Extracts the outputs of the top 12 layers
layer_outputs = [layer.output for layer in new_model.layers[:12]]
# Creates a model that will return these outputs, given the model input
# activation_model = models.Model(inputs=new_model.input,
outputs=layer_outputs)
activation_model = Model(inputs=new_model.input, outputs=layer_outputs)
print(img.shape)
# Returns a list of five Numpy arrays: one array per layer activation
activations = activation_model.predict(img)
# first layer activation
first_layer_activation = activations[0]
print(first_layer_activation.shape)
Я ожидаю увидеть вывод с проецируемыми на него объектами, как в этом примере 