Python 内核似乎已经死了
我是新手,请回答是对还是错 我正在azure笔记本上运行迁移学习模型 在执行epochs单元时,我得到一个错误,内核似乎已经死亡,它将自动重新启动 但是它卡在那里了Python 内核似乎已经死了,python,tensorflow,machine-learning,keras,Python,Tensorflow,Machine Learning,Keras,我是新手,请回答是对还是错 我正在azure笔记本上运行迁移学习模型 在执行epochs单元时,我得到一个错误,内核似乎已经死亡,它将自动重新启动 但是它卡在那里了 keras import applications #Load the base model, not including its final connected layer, and set the input shape to match our images
keras import applications
#Load the base model, not including its final connected layer, and set the input shape to
match our images
base_model = keras.applications.vgg16.VGG16(weights='imagenet', include_top=False,
input_shape=train_generator.image_shape)
from keras import Model
from keras.layers import Flatten, Dense
from keras import optimizers
# Freeze the already-trained layers in the base model
for layer in base_model.layers:
layer.trainable = False
# Create layers for classification of our images
x = base_model.output
x = Flatten()(x)
prediction_layer = Dense(len(classes), activation='sigmoid')(x)
model = Model(inputs=base_model.input, outputs=prediction_layer)
# Compile the model
opt = optimizers.Adam(lr=0.001)
model.compile(loss='categorical_crossentropy',optimizer=opt,metrics=['accuracy'])
# Now print the full model, which will include the layers of the base model plus the dense
layer we added
print(model.summary())
在这之后,我得到了层、输出形状和层中的参数
num_epochs = 1
history = model.fit_generator( train_generator,
steps_per_epoch = train_generator.samples // batch_size,
validation_data = validation_generator,
validation_steps = validation_generator.samples //
batch_size,
epochs = num_epochs)
在此单元之后,我得到了错误内核似乎已经死亡