深度学习课程:加载数据集时出错

2024-03-28 14:52:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我想有一个Andrew NG的Python赋值的Python作业,并在我的本地机器上运行。我已从该存储库下载了作业-https://github.com/amanchadha/coursera-deep-learning-specialization

对于this jupyter notebook assignment>C4-Convolutional Neural Networks> Week 1> Convolution_model_Application_v1a.ipynb),第一个单元格在我的计算机上工作正常,但第二个单元格工作正常

# Loading the data (signs)
X_train_orig, Y_train_orig, X_test_orig, Y_test_orig, classes = load_dataset()

给出以下错误-

--------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-2-6204c374be26> in <module>
      1 # Loading the data (signs)
----> 2 X_train_orig, Y_train_orig, X_test_orig, Y_test_orig, classes = load_dataset()

~/Documents/Coursera Deep Learning/C4 - Convolutional Neural Networks/Week 1/cnn_utils.py in load_dataset()
      7 
      8 def load_dataset():
----> 9     train_dataset = h5py.File('datasets/train_signs.h5', "r")
     10     train_set_x_orig = np.array(train_dataset["train_set_x"][:]) # your train set features
     11     train_set_y_orig = np.array(train_dataset["train_set_y"][:]) # your train set labels

~/anaconda3/lib/python3.8/site-packages/h5py/_hl/files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, rdcc_w0, track_order, **kwds)
    404             with phil:
    405                 fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, **kwds)
--> 406                 fid = make_fid(name, mode, userblock_size,
    407                                fapl, fcpl=make_fcpl(track_order=track_order),
    408                                swmr=swmr)

~/anaconda3/lib/python3.8/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
    171         if swmr and swmr_support:
    172             flags |= h5f.ACC_SWMR_READ
--> 173         fid = h5f.open(name, flags, fapl=fapl)
    174     elif mode == 'r+':
    175         fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (file signature not found)

有人能帮我修一下吗


Tags: nameintestmodeloadtraindatasetset