0
我是火炬手的新手。我已經通過這個指令https://github.com/soumith/imagenet-multiGPU.torch(班級數量被修改)按照2個班級訓練了我的模型,然後,我想測試我的模型。這些代碼行寫在測試指令中:火炬,測試問題 - imagenet-multiGPU.torch
dofile('donkey.lua')
img = testHook({loadSize}, 'test.jpg')
model = torch.load('model_10.t7')
if img:dim() == 3 then
img = img:view(1, img:size(1), img:size(2), img:size(3))
end
predictions = model:forward(img:cuda())
我在編寫代碼的初始代碼時出錯。 當我試圖寫作;
th> dofile('donkey.lua')
我得到這些錯誤;
th> dofile("donkey.lua")
donkey.lua:18: attempt to index global 'opt' (a nil value)
stack traceback:
donkey.lua:18: in main chunk
[C]: in function 'dofile'
[string "_RESULT={dofile("donkey.lua")}"]:1: in main chunk
[C]: in function 'xpcall'
/home/leo/torch/install/share/lua/5.1/trepl/init.lua:651: in function 'repl'
...leo/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
[C]: at 0x00406670
我不知道該怎麼做。感謝您的幫助。