jcjohnson / fast-neural-style

Feedforward style transfer
4.28k stars 813 forks source link

Errors Attempting to train Super Resolution Model #152

Open 3DTOPO opened 6 years ago

3DTOPO commented 6 years ago

I am attempting to train a super-resolution model, but I am getting errors below (using a 4x dataset prepped with make_sr_dataset.py).

@htoyryla I read you supplied an empty array for the style layers. Could you please tell me how you did that?

The training command I am running is: th train.lua -h5_file superRes_trainSet_284_4x_A.h5 -task upsample -checkpoint_name upsample_checkpoint_A_5k -gpu 0 -num_iterations 5000 -batch_size 1 -arch c9s1-64,R64,R64,R64,R64,u64,c9s1-3

What would a valid architecture be for 4x?

Might anyone be willing to share a super-res model just so I can see if it is even worth further investigating training my own model? (2x or 4x would be perfect).

/home/prime/torch/install/bin/luajit: /home/prime/torch/install/share/lua/5.1/nn/Container.lua:67: In 17 module of nn.Sequential: /home/prime/torch/install/share/lua/5.1/nn/THNN.lua:109: inconsistent tensor size at /home/prime/torch/extra/nn/lib/THNN/generic/MSECriterion.c:17 stack traceback: [C]: in function 'v' /home/prime/torch/install/share/lua/5.1/nn/THNN.lua:109: in function 'MSECriterion_updateOutput' /home/prime/torch/install/share/lua/5.1/nn/MSECriterion.lua:14: in function 'forward' ./fast_neural_style/ContentLoss.lua:43: in function <./fast_neural_style/ContentLoss.lua:39> [C]: in function 'xpcall' /home/prime/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors' /home/prime/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward' ./fast_neural_style/PerceptualCriterion.lua:134: in function 'forward' train.lua:197: in function 'opfunc' /home/prime/torch/install/share/lua/5.1/optim/adam.lua:37: in function 'adam' train.lua:239: in function 'main' train.lua:327: in main chunk [C]: in function 'dofile' ...rime/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00405d50

WARNING: If you see a stack trace below, it doesn't point to the place where this error occured. Please use only the one above. stack traceback: [C]: in function 'error' /home/prime/torch/install/share/lua/5.1/nn/Container.lua:67: in function 'rethrowErrors' /home/prime/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward' ./fast_neural_style/PerceptualCriterion.lua:134: in function 'forward' train.lua:197: in function 'opfunc' /home/prime/torch/install/share/lua/5.1/optim/adam.lua:37: in function 'adam' train.lua:239: in function 'main' train.lua:327: in main chunk [C]: in function 'dofile' ...rime/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00405d50

htoyryla commented 6 years ago

@htoyryla I read you supplied an empty array for the style layers. Could you please tell me how you did that?

No idea, after all this time. I guess I modified the code so that if no style layers are given, it uses an empty array. But reading what I wrote back then, the training failed (loss not decreasing). I think there are several viable solutions for superresolution.

I think I have used these (in no particular order):

https://github.com/alexjc/neural-enhance https://github.com/jacobgil/pytorch-zssr https://github.com/pytorch/examples/tree/master/super_resolution

suke27 commented 5 years ago

Hi, I want to ask how Johnson network do Super resolution, as you know input and output has same shape, should I resize input to output shape by opencv firstly then do forward by Johnson network?