代码问题【TADT//CVPR2019】
paper:Li X, Ma C, Wu B, et al. Target-Aware Deep Tracking[C]. //CVPR2019
调用adam.m时候报错
结构体内容引用自非结构体数组对象。
出错 solver.adam (line 62)
state.m = opts.beta1 * state.m + (1 - opts.beta1) * grad ;
原因是因为传递给adam函数的state参数是一个空数据,如果是这种情况应该是传一个0进去,因为adam.m的57行有写
if isequal(state, 0) % start off with state = 0 so as to get default state
state = struct('m', 0, 'v', 0, 't', 0);
end
所以修改cnn_train_dag_ridge函数的374行左右
在
[net.params(p).value, state.solverState{p}] = ...
params.solver(net.params(p).value, state.solverState{p}, ...
grad, params.solverOpts, thisLR) ;
这句前增加代码如下:
if(isempty(state.solverState{p}))
state.solverState{p}=0;
end