Giter Club home page Giter Club logo

Comments (10)

Lyken17 avatar Lyken17 commented on September 25, 2024

As shown in log, You may need to download the pretrained models by running, you didn't download the pretrained model.

Run wget https://github.com/Lyken17/Colorize-Your-World/releases/download/1.0/pre_trained.t7 to download

from colorize-your-world.

ConfusedLinda avatar ConfusedLinda commented on September 25, 2024

Thank you for your reply. But I have already run wget https://github.com/Lyken17/Colorize-Your-World/releases/download/1.0/pre_trained.t7 to download...and still have this problem.
Besides, when I run torch.load('pre_trained.t7') , it also has the same error.
How to do with this?
qq 20171028153953

from colorize-your-world.

Lyken17 avatar Lyken17 commented on September 25, 2024

The model is not loaded properly on you PC. I just tested the model on my server, and it works well. So the reason might be you did not set torch correctly. Can you run following setup scripts and test it again?

luarocks install torch
luarocks install nn
luarocks install nngraph
luarocks install image
luarocks install lua-cjson
luarocks install hdf5

#GPU acceleration
luarocks install cutorch
luarocks install cunn
luarocks install cudnn

from colorize-your-world.

Lyken17 avatar Lyken17 commented on September 25, 2024

Tests on my server

➜  Colorize-Your-World git:(master) ls
Backup          Demo.ipynb       NetModel.svg    TestImg    validation.lua
colorize.lua    make_dataset.py  pre_trained.t7  train.lua  Visualize Error.ipynb
DataLoader.lua  model.lua        README.md       utils.lua

➜  Colorize-Your-World git:(master) th

  ______             __   |  Torch7
 /_  __/__  ________/ /   |  Scientific computing for Lua.
  / / / _ \/ __/ __/ _ \  |  Type ? for help
 /_/  \___/_/  \__/_//_/  |  https://github.com/torch
                          |  http://torch.ch

th> require 'nngraph';
                                                                      [0.0528s]
th> checkpoint = torch.load("pre_trained.t7")
                                                                      [0.2179s]
th> model = checkpoint.model;
                                                                      [0.0000s]
th> model:evaluate()
                                                                      [0.0001s]

from colorize-your-world.

ConfusedLinda avatar ConfusedLinda commented on September 25, 2024

Thank you for your reply. I run the setup scripts and test it again. When I install cjson, it shows

gcc -O2 -fPIC -I/usr/include -c lua_cjson.c -o lua_cjson.o
In file included from lua_cjson.c:47:0:
fpconv.h:15:20: warning: inline function ‘fpconv_init’ declared but never defined
 extern inline void fpconv_init();
                    ^
gcc -O2 -fPIC -I/usr/include -c strbuf.c -o strbuf.o
gcc -O2 -fPIC -I/usr/include -c fpconv.c -o fpconv.o
gcc -shared -o cjson.so -L/usr/lib lua_cjson.o strbuf.o fpconv.o
Updating manifest for /usr/lib/luarocks/rocks
lua-cjson 2.1.0-1 is now built and installed in /usr/ (license: MIT)

Then I test again, it shows

th> checkpoint = torch.load("pre_trained.t7")
Warning: Failed to load function from bytecode: binary string: not a precompiled chunkWarning: Failed to load function from bytecode: [string ""]:1: unexpected symbol/home/kamata/torch/install/share/lua/5.2/torch/File.lua:308: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
	/home/kamata/torch/install/share/lua/5.2/trepl/init.lua:506: in function </home/kamata/torch/install/share/lua/5.2/trepl/init.lua:499>
	[C]: in function 'ipairs'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:308: in function 'readObject'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
	/home/kamata/torch/install/share/lua/5.2/nn/Module.lua:192: in function 'read'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:351: in function 'readObject'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
	/home/kamata/torch/install/share/lua/5.2/nn/Module.lua:192: in function 'read'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:351: in function 'readObject'
	...
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:353: in function 'readObject'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
	...e/kamata/torch/install/share/lua/5.2/nngraph/gmodule.lua:495: in function 'read'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:351: in function 'readObject'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
	/home/kamata/torch/install/share/lua/5.2/torch/File.lua:409: in function 'load'
	[string "checkpoint = torch.load("pre_trained.t7")"]:1: in main chunk
	[C]: in function 'xpcall'
	/home/kamata/torch/install/share/lua/5.2/trepl/init.lua:679: in function 'repl'
	...mata/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:204: in main chunk
	[C]: in ?	
kamata@kamata:~/linda/Colorize-Your-World$ th colorize.lua -input_image 't.jpg'
Warning: Failed to load function from bytecode: binary string: not a precompiled chunkWarning: Failed to load function from bytecode: [string ""]:1: unexpected symbolERROR: Could not load model from pre_trained.t7	
You may need to download the pretrained models by running	
bash download_colorization_model.sh	
/home/kamata/torch/install/bin/lua: colorize.lua:37: attempt to index global 'model' (a nil value)
stack traceback:
	colorize.lua:37: in main chunk
	[C]: in function 'dofile'
	...mata/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: in ?
kamata@kamata:~/lind

If I try another .t7 file, it is ok:

th> net = torch.load('colornet.t7')
                                                                      [0.2600s]	
th> net
{
  model : 
    {
      fg : 
        {
          edges : ....

I am sorry to trouble you again. Is there something wrong with my Torch? Or something wrong with my cjson?

from colorize-your-world.

Lyken17 avatar Lyken17 commented on September 25, 2024

not sure what happened. Looks some problem caused by nngraph module or torch itself. Could you try following possible solutions?

  1. luarocks install torch to update torch to latest version.
  2. Re-install torch from scratch
  3. This repo is a re-implementaion of siggraph paper, you can try their provided model.
  4. Another of my work Stylization Network can colorize images as well, which has 20 times less parameters but competitive performance.

Below are some information of my server, hope it helps you

  • OS : Ubuntu 16.04
  • GCC : 4.8.5
  • lua : 5.1
  • Torch : Latest (481c506, 6 weeks ago)
  • Hardware : GTX 1080Ti

from colorize-your-world.

ConfusedLinda avatar ConfusedLinda commented on September 25, 2024

Thank you very much! You are so kind.
The Stylization Network looks great. I will try these methods.

from colorize-your-world.

H0rst443 avatar H0rst443 commented on September 25, 2024

Got the same issue... downloaded and renamed the model to pre_trained.t7

th> cmd = torch.CmdLine()
[0.0000s]
th>
[0.0000s]
th> -- Model options
[0.0000s]
th> cmd:option('-model', 'pre_trained.t7')
[0.0000s]
th>
[0.0000s]
th> -- Input / output options
[0.0000s]
th> cmd:option('-input_image', 'In.jpg')
[0.0000s]
th> cmd:option('-output_image', 'out.png')
[0.0000s]
th> cmd:option('-input_dir', '')
[0.0000s]
th> cmd:option('-output_dir', '')
[0.0000s]
th> opt = cmd:parse(arg or {})
[0.0001s]
th> pcall(function() return torch.load(opt.model) end)
Warning: Failed to load function from bytecode: binary string: not a precompiled chunkWarning: Failed to load function from bytecode: [string ""]:1: unexpected symbolfalse /home/user/torch/install/share/lua/5.2/torch/File.lua:308: bad argument #1 to 'ipairs' (table expected, got nil)
[0.4197s]

--- and just trying to load the model...

th> torch.load(opt.model)
Warning: Failed to load function from bytecode: binary string: not a precompiled chunkWarning: Failed to load function from bytecode: [string ""]:1: unexpected symbol/home/user/torch/install/share/lua/5.2/torch/File.lua:308: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
/home/user/torch/install/share/lua/5.2/trepl/init.lua:506: in function </home/user/torch/install/share/lua/5.2/trepl/init.lua:499>
[C]: in function 'ipairs'
/home/user/torch/install/share/lua/5.2/torch/File.lua:308: in function 'readObject'
/home/user/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
/home/user/torch/install/share/lua/5.2/nn/Module.lua:192: in function 'read'
/home/user/torch/install/share/lua/5.2/torch/File.lua:351: in function 'readObject'
/home/user/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
/home/user/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
/home/user/torch/install/share/lua/5.2/nn/Module.lua:192: in function 'read'
/home/user/torch/install/share/lua/5.2/torch/File.lua:351: in function 'readObject'
...
/home/user/torch/install/share/lua/5.2/torch/File.lua:353: in function 'readObject'
/home/user/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
...user/torch/install/share/lua/5.2/nngraph/gmodule.lua:495: in function 'read'
/home/user/torch/install/share/lua/5.2/torch/File.lua:351: in function 'readObject'
/home/user/torch/install/share/lua/5.2/torch/File.lua:369: in function 'readObject'
/home/user/torch/install/share/lua/5.2/torch/File.lua:409: in function 'load'
[string "_RESULT={torch.load(opt.model)}"]:1: in main chunk
[C]: in function 'xpcall'
/home/user/torch/install/share/lua/5.2/trepl/init.lua:661: in function 'repl'
...uest/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:204: in main chunk
[C]: in ?
[0.4529s]

Something seems to be with the model. But got the same issue with colornet.t7 :(

from colorize-your-world.

H0rst443 avatar H0rst443 commented on September 25, 2024

Retried with Lua 5.1, got the same..

OS : Ubuntu 18.04
GCC : 9.3.0
lua : 5.1
Torch : Latest 
Hardware : GTX 1070

will retry with Ubuntu14.04..

from colorize-your-world.

Lyken17 avatar Lyken17 commented on September 25, 2024

Hi @H0rst443 , this codebase is oudated and no longer maintained. You may want to have a look at https://github.com/richzhang/colorization-pytorch for recent colorization technique.

from colorize-your-world.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.