在jupyter笔记本中运行cnn时内核崩溃

问题描述 投票:0回答:1

'我是一个window10用户,我在jupyter笔记本中运行tensorflow,感知器工作正常,但cnn内核崩溃。我也尝试增加缓冲区大小,但内核不断崩溃。 我在 Kolab 中使用 cnn 制作了一个模型,当我下载该模型并使用 Jupyter 笔记本运行它时,内核崩溃了。此外,使用 jupyter 笔记本制作模型会杀死内核。在 jupyter Notebook 中,可以使用感知器进行训练,但使用 cnn 时它总是会杀死内核。 但 .summary() 有效。怎么了?' '''

import numpy as np
import tensorflow as tf


testcnn=tf.keras.models.load_model("my_lasthomework_cnn.h5")
testcnn.summary()
import pandas as pd

from PIL import Image
test_dir='dir'
test_csv = pd.read_csv(test_dir+'test.csv')
test_images=[]
for file in test_csv['data']:
    image=np.array(Image.open(test_dir+'test/'+file))
    test_images.append(image)
test_images=np.array(test_images)


for i in test_images:
    p1=testcnn.predict(i.reshape(1,64,64,3))
    print(np.argmax(p1))

'''

python conv-neural-network
1个回答
0
投票

我正在学习有关机器/深度学习的 coursera 程序,并遇到了同样的问题 - 我的带 GPU 的惠普笔记本电脑在运行模型训练笔记本时会崩溃。

在 Windows 11 预览版上使用 cuda 在 WSL 上运行,并花了一些时间寻找问题的根本原因/解决方案。

但是,上面关于损坏的笔记本并将代码移动到新笔记(以及单独/新的虚拟环境)的建议立即解决了问题。

但我不得不说,我不知道失败的根本原因,只是新的笔记本/venv解决了问题。

© www.soinside.com 2019 - 2024. All rights reserved.