其他分享
首页 > 其他分享> > 使用带有lasagne NeuralNet的Conv2DLayer时出错

使用带有lasagne NeuralNet的Conv2DLayer时出错

作者:互联网

我有Windows 8.1 64位并使用推荐这里http://deeplearning.net/software/theano/install_windows.html#installing-theano python win-python发行版(python 3.4).我已经完成了教程的每一步(不包括CUDA的东西和GPU配置),卸载了所有内容并再次完成,但我的问题仍然存在.我正在尝试使用烤宽面条构建卷积神经网络.到目前为止我测试的每一层都在工作 – 只有Conv2DLayer会抛出错误.代码如下:

net2 = NeuralNet(
layers=[
    ('input', layers.InputLayer),
    ('conv1', layers.Conv2DLayer),
    ('pool1', layers.MaxPool2DLayer),
    ('hidden4', layers.DenseLayer),
    ('hidden5', layers.DenseLayer),
    ('output', layers.DenseLayer),
    ],
input_shape=(None, 1, 96, 96),
conv1_num_filters=32, conv1_filter_size=(3, 3),
pool1_pool_size=(2, 2),
hidden4_num_units=500, hidden5_num_units=500,
output_num_units=30, output_nonlinearity=None,
update_learning_rate=0.01,
update_momentum=0.9,
regression=True,
max_epochs=400,
verbose=1,
)

下面我贴了我得到的错误.我想gcc有些问题(我从教程中得到了确切版本),但无法确定问题是什么.我有最新版的千层面/ theano.我已经尝试过Anaconda和WinPython发行版.我已经尝试过使用python 2.7和3.4,并且无法找到解决此问题的任何方法.只有密集/ maxPooling层的网络运行得很好.如果有任何建议可以帮助我解决这个问题,我将不胜感激.

错误信息:

Problem occurred during compilation with the command line below:
g++.exe -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=haswell -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mrtm -mhle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=haswell -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\numpy\core\include -IC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\include -IC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof -o C:\Users\Michal\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\tmpgdh7ov2i\mf217e5b3a6b61b4ef70844368439f6cb.pyd C:\Users\Michal\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\tmpgdh7ov2i\mod.cpp -LC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\libs -LC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64 -lpython34
Traceback (most recent call last):

  File "", line 1, in 
    net2.fit(X, y)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\nolearn\lasagne\base.py", line 457, in fit
    self.initialize()

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\nolearn\lasagne\base.py", line 303, in initialize
    self.y_tensor_type,

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\nolearn\lasagne\base.py", line 435, in _create_iter_funcs
    allow_input_downcast=True,

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\compile\function.py", line 317, in function
    output_keys=output_keys)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\compile\pfunc.py", line 526, in pfunc
    output_keys=output_keys)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\compile\function_module.py", line 1778, in orig_function
    defaults)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\compile\function_module.py", line 1642, in create
    input_storage=input_storage_lists, storage_map=storage_map)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\link.py", line 690, in make_thunk
    storage_map=storage_map)[:3]

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\vm.py", line 1037, in make_all
    no_recycling))

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\op.py", line 932, in make_thunk
    no_recycling)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\op.py", line 850, in make_c_thunk
    output_storage=node_output_storage)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cc.py", line 1207, in make_thunk
    keep_lock=keep_lock)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cc.py", line 1152, in __compile__
    keep_lock=keep_lock)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cc.py", line 1602, in cthunk_factory
    key=key, lnk=self, keep_lock=keep_lock)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cmodule.py", line 1174, in module_from_key
    module = lnk.compile_cmodule(location)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cc.py", line 1513, in compile_cmodule
    preargs=preargs)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cmodule.py", line 2187, in compile_str
    (status, compile_stderr.replace('\n', '. ')))

Exception: ('The following error happened while compiling the node', CorrMM{valid, (1, 1)}(input.input, Subtensor{::, ::, ::int64, ::int64}.0), '\n', "Compilation failed (return status=1): C:\\Users\\Michal\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\\tmpgdh7ov2i\\mod.cpp: In member function 'int {anonymous}::__struct_compiled_op_mf217e5b3a6b61b4ef70844368439f6cb::run()':\r. C:\\Users\\Michal\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\\tmpgdh7ov2i\\mod.cpp:947:16: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]\r.              kH = NULL;\r.                 ^\r. C:\\Users\\Michal\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\\tmpgdh7ov2i\\mod.cpp:958:16: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]\r.              kW = NULL;\r.                 ^\r. C:\\Users\\Michal\\AppData\\Local\\Temp\\cc67su6o.o: In function `corrMM(tagPyArrayObject*, tagPyArrayObject*, tagPyArrayObject*, int, int, int, int, int)':\r. C:/Users/Michal/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64/tmpgdh7ov2i/mod.cpp:431: undefined reference to `dgemm_'\r. C:/Users/Michal/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64/tmpgdh7ov2i/mod.cpp:528: undefined reference to `dgemm_'\r. C:/Users/Michal/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64/tmpgdh7ov2i/mod.cpp:483: undefined reference to `dgemm_'\r. collect2.exe: error: ld returned 1 exit status\r. ", '[CorrMM{valid, (1, 1)}(input.input, )]')

解决方法:

我设法通过遵循IshanAntony在本网站https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13973/a-few-tips-to-install-theano-on-windows-64-bits/98833上给出的步骤来解决我的问题.显然Theano有正确连接BLAS的问题所以我下载并使用了open-BLAS并且错误消失了(下载和配置OPEN-BLAS所需的链接和步骤可以在IshanAntony的答案中找到).

标签:python,neural-network,conv-neural-network,theano,lasagne
来源: https://codeday.me/bug/20190702/1356320.html