Closed liuquan0722 closed 8 years ago
Hi Jimmy,
Hmmm, I could reproduce this, and then I did luarocks install loadcaffe
, and the problem disappeared. Can you try doing luarocks install loadcaffe
, and see if that changes something please?
I reinstalled loadcoffe. Kindly view below log. But the issue appears. :-( Bad luck to me
quans-Mac-mini:neural-style liuquan0722$ luarocks install loadcaffe
Installing https://raw.githubusercontent.com/torch/rocks/master/loadcaffe-1.0-0.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/loadcaffe-1.0-0.rockspec... switching to 'build' mode
Cloning into 'loadcaffe'...
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 18 (delta 0), reused 6 (delta 0), pack-reused 0
Receiving objects: 100% (18/18), 18.81 KiB | 0 bytes/s, done.
Checking connectivity... done.
cmake -E make_directory build;
cd build;
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/Users/liuquan0722/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/Users/liuquan0722/torch/install/lib/luarocks/rocks/loadcaffe/1.0-0";
make
-- The C compiler identification is AppleClang 7.0.0.7000176
-- The CXX compiler identification is AppleClang 7.0.0.7000176
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Torch7 in /Users/liuquan0722/torch/install
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found PROTOBUF: /usr/local/lib/libprotobuf.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/luarocks_loadcaffe-1.0-0-48/loadcaffe/build
[ 25%] Running C++ protocol buffer compiler on caffe.proto
Scanning dependencies of target loadcaffe
[ 50%] Building CXX object CMakeFiles/loadcaffe.dir/loadcaffe.cpp.o
[ 75%] Building CXX object CMakeFiles/loadcaffe.dir/caffe.pb.cc.o
[100%] Linking CXX shared module libloadcaffe.so
[100%] Built target loadcaffe
cd build && make install
[100%] Built target loadcaffe
Install the project...
-- Install configuration: "Release"
-- Installing: /Users/liuquan0722/torch/install/lib/luarocks/rocks/loadcaffe/1.0-0/lib/libloadcaffe.so
-- Installing: /Users/liuquan0722/torch/install/lib/luarocks/rocks/loadcaffe/1.0-0/lua/loadcaffe/ffi.lua
-- Installing: /Users/liuquan0722/torch/install/lib/luarocks/rocks/loadcaffe/1.0-0/lua/loadcaffe/init.lua
-- Installing: /Users/liuquan0722/torch/install/lib/luarocks/rocks/loadcaffe/1.0-0/lua/loadcaffe/loadcaffe.lua
-- Installing: /Users/liuquan0722/torch/install/lib/luarocks/rocks/loadcaffe/1.0-0/lua/loadcaffe/test.lua
Updating manifest for /Users/liuquan0722/torch/install/lib/luarocks/rocks
loadcaffe 1.0-0 is now built and installed in /Users/liuquan0722/torch/install/ (license: BSD)
run neural_style.lua again
/Users/liuquan0722/torch/install/bin/luajit: ...22/torch/install/share/lua/5.1/nn/SpatialConvolution.lua:100: bad argument #2 to 'SpatialConvolutionMM_updateOutput' (input channels and nInputPlane dont match)
stack traceback:
[C]: in function 'SpatialConvolutionMM_updateOutput'
...22/torch/install/share/lua/5.1/nn/SpatialConvolution.lua:100: in function 'updateOutput'
...iuquan0722/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
neural_style.lua:176: in function 'main'
neural_style.lua:497: in main chunk
[C]: in function 'dofile'
...0722/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x010749cbc0
Hmmm, that's odd. I think it'd be good to make sure everything is a recent version. Can you do the following please:
luarocks install torch7
luarocks install nn
luarocks install cltorch
luarocks install clnn
luajit -l cltorch -e 'cltorch.about()'
luajit -l clnn -e 'clnn.about()'
... and provide the output from the last couple of commands, and also rerun the neural_style, and check what happens. And also provide the output from git log -n 5 --oneline
, from within the neural-style directory.
Hi Hugh, Sorry for late response.
As per your suggestion, I installed them as below: 1, install itorch as per the instruction http://torch.ch/docs/getting-started.html#_ 2, resolved ipython not found issue. https://github.com/facebook/iTorch/issues/5 3, install nn 4, install cltorch 5, install clnn 6 luajit -l cltorch -e 'cltorch.about()' 7 luajit -l clnn -e 'clnn.about()'
Output:
(ip)quans-Mac-mini:neural-style liuquan0722$ luajit -l cltorch -e 'cltorch.about()'
cltorch. OpenCL backend for Torch
Built from commit ddb1964
More info, doc: https://github.com/hughperkins/cltorch
Issues: https://github.com/hughperkins/cltorch/issues
(ip)quans-Mac-mini:neural-style liuquan0722$ luajit -l clnn -e 'clnn.about()'
libthclnn_searchpath /Users/liuquan0722/torch/install/lib/lua/5.1/libTHCLNN.so
clnn. OpenCL backend for Torch nn
Built from commit
More info, doc: https://github.com/hughperkins/clnn
Issues: https://github.com/hughperkins/clnn/issues
(ip)quans-Mac-mini:neural-style liuquan0722$ git log -n 5 --oneline
8b7102f Merged from jcjohnson/neural-style master branch
6749437 OpenCL Support complete.
9e0b57d Merge branch 'master' of https://github.com/jcjohnson/neural-style
8795bbf fix loadcaffe_wrapper to work again in CPU mode
42f83bc Merge pull request #54 from bcipolli/resume_downloads
Many thanks for your patience on the issue. I still get the same error.
(ip)quans-Mac-mini:neural-style liuquan0722$ th neural_style.lua -style_image examples/inputs/picasso_selfport1907.jpg -content_image examples/inputs/brad_pitt.jpg -output_image profile.png -model_file models/nin_imagenet_conv.caffemodel -proto_file models/train_val.prototxt -gpu 0 -backend clnn -num_iterations 1000 -seed 123 -content_layers relu0,relu3,relu7,relu12 -style_layers relu0,relu3,relu7,relu12 -content_weight 10 -style_weight 1000 -image_size 512 -optimizer adam
libthclnn_searchpath /Users/liuquan0722/torch/install/lib/lua/5.1/libTHCLNN.so
Successfully loaded models/nin_imagenet_conv.caffemodel
MODULE data UNDEFINED
warning: module 'data [type 5]' not found
Changing line: table.insert(model, {'pool4', nn.SpatialAveragePooling(6, 6, 1, 1):ceil()})
To line: table.insert(model, {'pool4', nn.SpatialAveragePooling(6, 6, 1, 1):ceil():ceil()})
cccp1: 96 96 1 1
cccp2: 96 96 1 1
conv2: 256 96 5 5
cccp3: 256 256 1 1
cccp4: 256 256 1 1
conv3: 384 256 3 3
cccp5: 384 384 1 1
cccp6: 384 384 1 1
conv4-1024: 1024 384 3 3
cccp7-1024: 1024 1024 1 1
cccp8-1024: 1000 1024 1 1
Using Apple , OpenCL platform: Apple
Using OpenCL device: ATI Radeon HD 6630M
Setting up content layer 1 : relu0
Setting up style layer 1 : relu0
WARNING: Skipping content loss
Setting up content layer 8 : relu3
THClReduceAll.cl build log:
<program source>:11:10: warning: unused variable 'in1'
float *in1 = &_in1;
^
<program source>:12:10: warning: unused variable 'out'
float *out = &_out;
^
/Users/liuquan0722/torch/install/bin/luajit: ...22/torch/install/share/lua/5.1/nn/SpatialConvolution.lua:100: bad argument #2 to 'SpatialConvolutionMM_updateOutput' (input channels and nInputPlane dont match)
stack traceback:
[C]: in function 'SpatialConvolutionMM_updateOutput'
...22/torch/install/share/lua/5.1/nn/SpatialConvolution.lua:100: in function 'updateOutput'
...iuquan0722/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
neural_style.lua:176: in function 'main'
neural_style.lua:497: in main chunk
[C]: in function 'dofile'
...0722/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x0106639bc0
Torch7 should be installed as well
(ip)quans-Mac-mini:neural-style liuquan0722$ th
______ __ | Torch7
/_ __/__ ________/ / | Scientific computing for Lua.
/ / / _ \/ __/ __/ _ \ | Type ? for help
/_/ \___/_/ \__/_//_/ | https://github.com/torch
| http://torch.ch
th> torch.Tensor{1,2,3}
1
2
3
[torch.DoubleTensor of size 3]
[0.0315s]
th>
Hmmm, I probably need to provide some kind of debug version, so I can see what is going on. Will try to find a moment to do this.
Interestingly, my output is quite different:
th neural_style.lua -style_image examples/inputs/picasso_selfport1907.jpg -content_image examples/inputs/brad_pitt.jpg -output_image profile.png -model_file models/nin_imagenet_conv.caffemodel -proto_file models/train_val.prototxt -gpu 0 -backend clnn -num_iterations 1000 -seed 123 -content_layers relu0,relu3,relu7,relu12 -style_layers relu0,relu3,relu7,relu12 -content_weight 10 -style_weight 1000 -image_size 512 -optimizer adam
Successfully loaded models/nin_imagenet_conv.caffemodel
conv1: 96 3 11 11
cccp1: 96 96 1 1
cccp2: 96 96 1 1
conv2: 256 96 5 5
cccp3: 256 256 1 1
cccp4: 256 256 1 1
conv3: 384 256 3 3
cccp5: 384 384 1 1
cccp6: 384 384 1 1
conv4-1024: 1024 384 3 3
cccp7-1024: 1024 1024 1 1
cccp8-1024: 1000 1024 1 1
Using NVIDIA Corporation , OpenCL platform: NVIDIA CUDA
Using OpenCL device: GeForce 940M
Setting up content layer 2 : relu0
Setting up style layer 2 : relu0
WARNING: Skipping content loss
Setting up content layer 9 : relu3
Setting up style layer 9 : relu3
WARNING: Skipping content loss
Setting up content layer 16 : relu7
Setting up style layer 16 : relu7
WARNING: Skipping content loss
Setting up content layer 28 : relu12
Setting up style layer 28 : relu12
Look at the numbers eg of the first line. You get, well, you're missing the conv1
layer for some reason...
Can you provide the output of the following please:
luajit -l loadcaffe -e "loadcaffe.load('models/train_val.prototxt', 'models/nin_imagenet_conv.caffemodel', 'nn')"
Also, can you do luarocks install loadcaffe
, and retry, and confirm output after reinstalling loadcaffe? (Also, can you paste the output from running luarocks install loadcaffe
please?)
Since this is kind of old, closing it. Feel free to reopen it if you still need it.
Hi Hugh, When I run the neural-style.lua with openCL, I got below errors. it seems some library is missing, right? Appreciate it if the issue could be looked at.