Neural-style: Cannot find libpng

Created on 1 Oct 2015  路  11Comments  路  Source: jcjohnson/neural-style

Hi,

I tried to reproduce the graph,

Sails-MacBook-Pro:neural-style sailient$ th neural_style.lua -style_image starry_night.jpg -content_image golden_gate.jpg -gpu -1

But I got the following error message:
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:537] Reading dangerously large protocol message. If the message turns out to be larger than 1073741824 bytes, parsing will be halted for security reasons. To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:78] The total number of bytes read was 574671192
Successfully loaded models/VGG_ILSVRC_19_layers.caffemodel
conv1_1: 64 3 3 3
conv1_2: 64 64 3 3
conv2_1: 128 64 3 3
conv2_2: 128 128 3 3
conv3_1: 256 128 3 3
conv3_2: 256 256 3 3
conv3_3: 256 256 3 3
conv3_4: 256 256 3 3
conv4_1: 512 256 3 3
conv4_2: 512 512 3 3
conv4_3: 512 512 3 3
conv4_4: 512 512 3 3
conv5_1: 512 512 3 3
conv5_2: 512 512 3 3
conv5_3: 512 512 3 3
conv5_4: 512 512 3 3
fc6: 1 1 25088 4096
fc7: 1 1 4096 4096
fc8: 1 1 4096 1000
Setting up style layer 2 : relu1_1
Setting up style layer 7 : relu2_1
Setting up style layer 12 : relu3_1
Setting up style layer 21 : relu4_1
Setting up content layer 23 : relu4_2
Setting up style layer 30 : relu5_1
WARNING: Skipping content loss
Running optimization with L-BFGS
creating recyclable direction/step/history buffers
Iteration 50 / 1000
Content 1 loss: 3379094.062500
Style 1 loss: 27619.131470
Style 2 loss: 596076.611328
Style 3 loss: 300044.799805
Style 4 loss: 1338347.558594
Style 5 loss: 3564.146805
Total loss: 5644746.310501
Iteration 100 / 1000
Content 1 loss: 2358931.406250
Style 1 loss: 6602.608490
Style 2 loss: 82185.144043
Style 3 loss: 43564.587402
Style 4 loss: 400567.944336
Style 5 loss: 3723.546982
Total loss: 2895575.237503
/Users/sailient/torch/install/share/lua/5.1/trepl/init.lua:363: ...sailient/torch/install/share/lua/5.1/luarocks/loader.lua:117: error loading module 'libpng' from file '/Users/sailient/torch/install/lib/lua/5.1/libpng.so':
dlopen(/Users/sailient/torch/install/lib/lua/5.1/libpng.so, 6): Library not loaded: libpng15.15.dylib
Referenced from: /Users/sailient/torch/install/lib/lua/5.1/libpng.so
Reason: image not found
warning: could not be loaded (is it installed?)
/Users/sailient/torch/install/bin/luajit: /Users/sailient/torch/install/share/lua/5.1/dok/inline.lua:737: libpng package not found, please install libpng
stack traceback:
[C]: in function 'error'
/Users/sailient/torch/install/share/lua/5.1/dok/inline.lua:737: in function 'error'
/Users/sailient/torch/install/share/lua/5.1/image/init.lua:156: in function 'saver'
/Users/sailient/torch/install/share/lua/5.1/image/init.lua:354: in function 'save'
neural_style.lua:262: in function 'maybe_save'
neural_style.lua:284: in function 'opfunc'
/Users/sailient/torch/install/share/lua/5.1/optim/lbfgs.lua:211: in function 'lbfgs'
neural_style.lua:294: in function 'main'
neural_style.lua:454: in main chunk
[C]: in function 'dofile'
...ient/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x010fede190

However, I do install the libpng:

Sails-MacBook-Pro:neural-style sailient$ brew install libpng
Warning: libpng-1.6.18 already installed

May I know what's the issue here? Thanks!

Most helpful comment

This worked for me @danrosero
first:
brew install linpng
then re-instal via luarocks:
luarocks install image

All 11 comments

I believe luarocks install image fixed that same error for me.
Also, I installed (not sure if it was necessary) libpng++-dev and libpng12-dev, but I'm on Ubuntu (sudo apt-get install libpng++-dev libpng12-dev).

Thanks.. I did reinstall image.. but somehow the same problem still exists...

Make sure you have libpng installed - you can install using homebrew with brew install libpng.

Thanks Justin.

I did install libpng:
$ brew install libpng
Warning: libpng-1.6.18 already installed.
Even after I reinstall everything, the same error still persists.

I wonder if you can find libpng in other contexts, or whether the problem is specific to your torch install.

For example, if you install numpy, scipy, and Pillow, can you use scipy.misc.imread?

I reinstalled the all the dependencies again. Now the codes seem to work! Thanks!

HI @fallensail , im having a hard time. Same issue with libpng. How did you fix? What dependencies you reinstalled?

Thanks.

This worked for me @danrosero
first:
brew install linpng
then re-instal via luarocks:
luarocks install image

@hughhopkins Awesome!! It works! Thanks a lot:)

Same problem here.

I believe luarocks install image fixed that same error for me.
Also, I installed (not sure if it was necessary) libpng++-dev and libpng12-dev, but I'm on Ubuntu (sudo apt-get install libpng++-dev libpng12-dev).

@cambraca This works for me, thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tegarkurniawan picture tegarkurniawan  路  9Comments

lmsanch picture lmsanch  路  5Comments

IAMJackal picture IAMJackal  路  11Comments

wmco picture wmco  路  4Comments

JeffCrusey picture JeffCrusey  路  4Comments