2017-10-19 58 views
0

當我工作的尖峯神經網絡,並下載了https://github.com/peter-u-diehl/stdp-mnistIO錯誤試圖打開生成的文件在Python

我有這段代碼運行嚴重故障的標杆,我已經安裝了必要的東西。

見作爲代碼生成的錯誤運行

100%完成,0經過,約0剩餘。

完成100%,經過0秒,剩下大約0秒。

完成100%,經過0秒,剩下大約0秒。

保存根據你的錯誤No such file or director: './activity/resultPopVecs100.npy你可能產生一個錯誤的方式的文件路徑結果

Traceback (most recent call last): 

    File "peterb1.py", line 516, in <module> 

    np.save(data_path + 'activity/resultPopVecs' + str(num_examples), result_monitor) 

    File "/srv/home/compsci/anaconda2/envs/py2b1/lib/python2.7/site-packages 

/numpy/lib/npyio.py", line 490, in save 

    fid = open(file, "wb") 

IOError: [Errno 2] No such file or directory: './activity/resultPopVecs100.npy' 

[email protected]:~/Desktop/pt1$ 

代碼

print ('save results') 

if not test_mode: 
    save_theta() 
if not test_mode: 
    save_connections() 
else: 
    np.save(data_path + 'activity/resultPopVecs' + str(num_examples), result_monitor) 
    np.save(data_path + 'activity/inputNumbers' + str(num_examples), input_numbers) 
+0

使標題更詳細地描述了引發的實際錯誤。 –

回答

0

  1. 確認您的/activity文件夾中有一個名爲resultPopVecs100.npy的文件。
  2. 使用os python庫生成文件路徑。

要獲取實際的系統文件路徑到您運行腳本的位置,請使用以下代碼片段,然後使用該文件構建文件路徑的其餘部分。

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
+0

** @ Marcus Lind **感謝您的回覆...................................... ......實際上,基準測試使用的是來自https://github.com/peter-u-diehl/stdp-mnist的Peter U Diehl和MNIST數據集,其中包含60,000個示例的訓練集,以及10,000個示例「http://yann.lecun.com/exdb/mnist/」**主要問題**我想從60,000減少到2000個訓練集和10,000到100個測試集,以便我的傳統PC運行程序,**但是**沒有生成輸出到活動文件夾**我如何使用代碼縮小..... **請您的支持 – DLord