pycharm tensorflow 过程已完成,退出代码为-1073740791(0xC 0000409)STATUS_STACK_BUFFER_OVERRUN [重复]

toe95027  于 2022-11-08  发布在  PyCharm
关注(0)|答案(1)|浏览(273)

此问题在此处已有答案

Process finished with exit code -1073740791 (0xC0000409) STATUS_STACK_BUFFER_OVERRUN(4个答案)
上个月关门了。
我尝试跟随this tutorial,但无法训练第一个网络。它崩溃并显示以下消息:
进程已结束,退出代码为-1073740791(0xC 0000409)
并且不会抛出错误,所以我不知道该搜索什么
我用的是Pycharm社区版和python 3.7,我不是很有经验。
我还在谷歌上搜索了不同的教程,但它们都非常相似。我把所有东西都用到了构建模型的地步,但训练无法开始。教程使用了model.fit_generate函数,但这引发了一个错误,所以我使用了model.fit函数。我使用的fit函数是否有误?
下面是我代码:


# baseline model for the dataset

import sys
from matplotlib import pyplot
from keras.utils import to_categorical
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPool2D
from keras.layers import Dense
from keras.layers import Flatten
from keras.optimizers import SGD
from keras.preprocessing.image import ImageDataGenerator

# define cnn model

def define_model():
    model = Sequential()
    model.add(Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_uniform', padding='same',
                     input_shape=(200, 200, 3)))
    model.add(MaxPool2D((2, 2)))
    model.add(Flatten())
    model.add(Dense(128, activation='relu', kernel_initializer='he_uniform'))
    model.add(Dense(1, activation='sigmoid'))
    # compile model
    opt = SGD(lr=0.001, momentum=0.9)
    model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
    model.summary()
    return model

# run the test harness for evaluating a model

def run_test_harness():
    # define model
    model = define_model()
    # create data generator
    datagen = ImageDataGenerator(rescale=1.0 / 255.0)
    # prepare iterators
    train_it = datagen.flow_from_directory('data_dogs_vs_cats/train', class_mode='binary', batch_size=64,
                                           target_size=(200, 200))
    test_it = datagen.flow_from_directory('data_dogs_vs_cats/val', class_mode='binary', batch_size=64,
                                          target_size=(200, 200))
    # fit model
    history = model.fit(train_it, steps_per_epoch=len(test_it), validation_data=test_it, validation_steps=len(test_it),
                        epochs=20, verbose=0)
    # evaluate model
    _, acc = model.evaluate_generator(test_it, steps=len(test_it), verbose=0)
    print('> %.3f' % (acc * 100.0))

# entry point

run_test_harness()
m0rkklqb

m0rkklqb1#

我遇到了这个问题,原因是PyCharm在直接从内部运行代码时隐藏了错误。尝试从命令行/终端运行代码,您将看到是哪些错误导致了此崩溃。
当cuda的bin目录中缺少DLL或代码中存在其他错误时,可能会发生这种情况。
在我的案例中,我的cuda bin文件夹(C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA)中缺少以下DLL:

  • cudnn64_8.dll
  • cudnn_ops_train64_8.dll
  • cudnn_ops_infer64_8.dll
  • cudnn_cnn_infer64_8.dll

相关问题