我正在尝试为MNIST编码CNN。但是,一旦我运行了以下几行:
import tensorflow
import mnist
from mnist import MNIST
import numpy as np
mntrain = MNIST("E:/MNIST/")
mntrain.load_training()
此框弹出:
FileNotFoundError Traceback (most recent call last)
<ipython-input-22-4e645408be54> in <module>()
1 mntrain = MNIST("E:/MNIST/")
----> 2 mntrain.load_training()
c:\users\thang\appdata\local\programs\python\python35\lib\site-packages\mnist\loader.py in load_training(self)
124 def load_training(self):
125 ims, labels = self.load(os.path.join(self.path, self.train_img_fname),
--> 126 os.path.join(self.path, self.train_lbl_fname))
127
128 self.train_images = self.process_images(ims)
c:\users\thang\appdata\local\programs\python\python35\lib\site-packages\mnist\loader.py in load(self, path_img, path_lbl, batch)
245 '(start_point, batch_size)')
246
--> 247 with self.opener(path_lbl, 'rb') as file:
248 magic, size = struct.unpack(">II", file.read(8))
249 if magic != 2049:
c:\users\thang\appdata\local\programs\python\python35\lib\site-packages\mnist\loader.py in opener(self, path_fn, *args, **kwargs)
237 return gzip.open(path_fn + '.gz', *args, **kwargs)
238 else:
--> 239 return open(path_fn, *args, **kwargs)
240
241 def load(self, path_img, path_lbl, batch=None):
FileNotFoundError: [Errno 2] No such file or directory: 'E:/MNIST/train-labels-idx1-ubyte'
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
我相信我已经为MNIST设置了绝对路径,但是没有用。反正有我可以解决的吗?