使用高斯过程回归的Matlab GPML超分辨率

时间:2015-04-13 19:28:51

标签: regression supervised-learning

我正在使用GPR使用基于学习的方法进行图像超分辨率。但在我的案例中,我遇到了实施gpr的问题。基本上,我正在进行基于补丁的回归,其中我有k个补丁对用于训练。然后使用回归函数预测测试输出。当运行下面的代码我进入gpr推理,else块的失败消息,我不完全理解gpml所以我无法继续并且已经卡住了很长时间。任何帮助将不胜感激。请快速回复。感谢。

% GPR model training
% GPR functions
hyp.mean = [];
meanfunc = @meanAvg;
covfunc = @covSEiso;
likfunc = @likGauss;


for m = 1:knn
    In_patch_nn{m,1} = hrb_patches{Dnn(m,2),Dnn(m,3)};
    Out_patch_nn{m,1} = HR_patches{Dnn(m,2),Dnn(m,3)};
end

X = zeros(knn,sh^2);  % for input in gpr model 
for m=1:knn

X(m,:) = In_patch_nn{m,1}(:);

end
% gpr for each pixel in the output patch
temp_out = zeros(sh);
for b = 1:sh
    for c = 1:sh
        y = zeros(knn,1);
        % initialize GPr parameter

        cov = [-1.5; log(std(double(hrb_patches{Dnn(1,2),Dnn(1,3)}(:))))]; lik = -3;   %%%%% doubt how to initialize??
        hyp.cov = cov;
        hyp.lik = lik;

        for e = 1:knn
            y(e,1) = Out_patch_nn{e,1}(b,c);     % training target values (output)
        end
        % MAP estimation
        [hyp] = minimize(hyp, @gp, -100, @infExact, meanfunc,covfunc, likfunc, X, y);

         % GPR inference
        [fail ymu] = gp(hyp, @infExact, meanfunc, covfunc, likfunc, double(X(:,:)), double(y(:)), double(temp(:)'));

        if fail==0 && length(ymu)~=1 && ~isinf(hyp.cov(1)) && ~isinf(hyp.cov(1)) && ~isinf(hyp.lik)
            temp_out(b,c) = ymu;
        else
            fprintf('fail %d\n',j);
        end
    end
end
Patch_mat_n{j,3} = temp_out;
% patch prediction

end

0 个答案:

没有答案