Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 内核似乎已经死了_Python_Tensorflow_Machine Learning_Keras - Fatal编程技术网

Python 内核似乎已经死了

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

我是新手,请回答是对还是错

我正在azure笔记本上运行迁移学习模型

在执行epochs单元时,我得到一个错误,内核似乎已经死亡,它将自动重新启动

但是它卡在那里了

          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)
在此单元之后,我得到了错误内核似乎已经死亡

  • 只需重新启动内核并重试
  • 2.内核死亡的原因可能有很多:

    缺货

    不活动

    GPU等用完了