第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在加載 MNIST 數(shù)據(jù)集時修復“沒有這樣的文件或目錄”錯誤

如何在加載 MNIST 數(shù)據(jù)集時修復“沒有這樣的文件或目錄”錯誤

慕哥6287543 2021-11-02 19:26:24
我已經(jīng)從 yann.lecun.com 下載了 MNIST 訓練圖像和標簽并解壓了它們。我正在嘗試使用此代碼加載它們-from mlxtend.data import loadlocal_mnistfeatures,labels = loadlocal_mnist(    images_path='/python/mnist-files/train-images-idx3-ubyte',    labels_path='/python/mnist-files/train-labels-idx1-ubyte')但是,我收到此錯誤 -Traceback (most recent call last):  File "generateClassifier.py", line 12, in <module>    labels_path='/python/mnist-files/train-labels-idx1-ubyte')  File "/home/inglorion/.local/lib/python3.6/site- packages/mlxtend/data/local_mnist.py", line 36, in loadlocal_mnist    with open(labels_path, 'rb') as lbpath:FileNotFoundError: [Errno 2] No such file or directory: '/python/mnist- files/train-labels-idx1-ubyte'該目錄確實存在,并且文件名是正確的。我怎樣才能解決這個問題?編輯:我試著用同樣的python-mnist套餐-from mnist import MNISTmndata = MNIST('/python/mnist-files')features,labels = mndata.load_training()我遇到了類似的錯誤-Traceback (most recent call last):  File "generateClassifier.py", line 11, in <module>    features,labels = mndata.load_training()  File "/home/inglorion/.local/lib/python3.6/site-packages/mnist/loader.py", line 126, in load_training    os.path.join(self.path, self.train_lbl_fname))  File "/home/inglorion/.local/lib/python3.6/site-packages/mnist/loader.py", line 247, in load    with self.opener(path_lbl, 'rb') as file:  File "/home/inglorion/.local/lib/python3.6/site-packages/mnist/loader.py", line 239, in opener    return open(path_fn, *args, **kwargs)FileNotFoundError: [Errno 2] No such file or directory: '/python/mnist- files/train-labels-idx1-ubyte'錯誤似乎只與訓練標簽文件有關;我嘗試重新下載該文件,但這并沒有解決它。編輯 2:根據(jù)要求,這里是輸出ls -l /python/mnist-files-total 46156-rw-r--r-- 1 inglorion inglorion 47040016 Jul 21  2000 train-images-idx3- ubyte-rw-r--r-- 1 inglorion inglorion    60008 Jul 21  2000 train-labels-idx1- ubyte-rw-r--r-- 1 inglorion inglorion   147970 Feb  8 22:43 wget-log-rw-r--r-- 1 inglorion inglorion      682 Feb  9 14:40 wget-log.1
查看完整描述

3 回答

?
蝴蝶不菲

TA貢獻1810條經(jīng)驗 獲得超4個贊

對我來說,它有助于將文件重命名為train-images.idx3-ubyte而不是train-images-idx3-ubyte-之后images更改為 a .)。


查看完整回答
反對 回復 2021-11-02
?
UYOU

TA貢獻1878條經(jīng)驗 獲得超4個贊

a /和~之間有區(qū)別。默認情況下,


os.dir('/')

將在'/'. 我猜你的文件 python 就在'~'你的主目錄中。


你可以試試這個:


from os.path import expanduser

home = expanduser("~")+'/python/mnist-files'

mndata = MNIST(home)

features,labels = mndata.load_training()

如果有幫助,請告訴我。


查看完整回答
反對 回復 2021-11-02
?
慕娘9325324

TA貢獻1783條經(jīng)驗 獲得超4個贊

您可以嘗試使用此代碼。


from tensorflow.examples.tutorials.mnist import input_data

mnist = input_data.read_data_sets('MNIST_data', validation_size=0)

我已經(jīng)執(zhí)行了代碼,它工作正常!!希望你會發(fā)現(xiàn)它有幫助。


查看完整回答
反對 回復 2021-11-02
  • 3 回答
  • 0 關注
  • 1156 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號