将 Conv2DLayer 与 lasagne NeuralNet 一起使用时出错
Error while using Conv2DLayer with lasagne NeuralNet
我有 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 有问题(我从教程中得到了确切的版本)但无法真正弄清楚问题是什么。我有 lasagne/theano 的前沿版本。我已经尝试过 Anaconda 和 WinPython 发行版。我已经用 python 2.7 和 3.4 都试过了,但找不到任何解决这个问题的方法。只有 dense/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 的答案中找到)。
我有 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 有问题(我从教程中得到了确切的版本)但无法真正弄清楚问题是什么。我有 lasagne/theano 的前沿版本。我已经尝试过 Anaconda 和 WinPython 发行版。我已经用 python 2.7 和 3.4 都试过了,但找不到任何解决这个问题的方法。只有 dense/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 的答案中找到)。