我用的是jupyter notebook.在第二周的编程作业中,我在加载数据的时候会报出打开不了.h5这个文件,如下:
#Loading the data (cat/non-cat)
train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes = load_dataset()
OSError Traceback (most recent call last)
in ()
1 # Loading the data (cat/non-cat)
----> 2 train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes = load_dataset()
~\lr_utils.py in load_dataset()
4
5 def load_dataset():
----> 6 train_dataset = h5py.File('train_catvnoncat.h5', "r")
7 train_set_x_orig = np.array(train_dataset["train_set_x"][:]) # your train set features
8 train_set_y_orig = np.array(train_dataset["train_set_y"][:]) # your train set labels
d:\asoftware\python-3.5.4\benti\lib\site-packages\h5py_hl\files.py in init(self, name, mode, driver, libver, userblock_size, swmr, **kwds)
267 with phil:
268 fapl = make_fapl(driver, libver, **kwds)
--> 269 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
270
271 if swmr_support:
d:\asoftware\python-3.5.4\benti\lib\site-packages\h5py_hl\files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
97 if swmr and swmr_support:
98 flags |= h5f.ACC_SWMR_READ
---> 99 fid = h5f.open(name, flags, fapl=fapl)
100 elif mode == 'r+':
101 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 (unable to open file: name = 'datasets/train_catvnoncat.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)