jcjohnson / densecap

Dense image captioning in Torch
MIT License
1.58k stars 432 forks source link

Can't evaluate pretrained model #85

Open mees opened 5 years ago

mees commented 5 years ago

Hi, when I try to evaluate the pretrained model with 'th evaluate_model.lua 'I get following error:

/home/meeso/torch/install/bin/luajit: /home/meeso/torch/install/share/lua/5.1/nn/Container.lua:67: 
In 3 module of nn.Sequential:
/home/meeso/torch/install/share/lua/5.1/nn/THNN.lua:110: bad argument #8 to 'v' (cannot convert 'nil' to 'int64_t')
stack traceback:
    [C]: in function 'v'
    /home/meeso/torch/install/share/lua/5.1/nn/THNN.lua:110: in function 'ClassNLLCriterion_updateOutput'
    ...eso/torch/install/share/lua/5.1/nn/ClassNLLCriterion.lua:41: in function 'updateOutput'
    ./densecap/modules/OurCrossEntropyCriterion.lua:19: in function 'forward'
    ./densecap/LocalizationLayer.lua:466: in function 'f'
    ./densecap/LocalizationLayer.lua:228: in function 'timeit'
    ./densecap/LocalizationLayer.lua:455: in function <./densecap/LocalizationLayer.lua:383>
    [C]: in function 'xpcall'
    /home/meeso/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
    /home/meeso/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
    ./densecap/DenseCapModel.lua:255: in function 'forward'
    ./densecap/DenseCapModel.lua:411: in function 'forward_backward'
    ./eval/eval_utils.lua:62: in function 'eval_split'
    evaluate_model.lua:64: in main chunk
    [C]: in function 'dofile'
    ...eeso/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
    [C]: at 0x00406670

Any idea how to solve it?

doiken23 commented 3 years ago

Did you solve it? I have the same problem.

doiken23 commented 3 years ago

@mees

I solved the problem by commenting out lines 39,58,59,78,79,80,81. Maybe the calculation of the loss is not needed.