2017-04-08 9 views
0

機械学習を使用して深さマップを推定しました。私は結果を評価したい(matlabを使用して)。深度マップと深度trueは、8ビットの画像です(評価前に[0 1]に正規化されています)。私はrelative、rmse、およびlog 10エラーを使用して評価のステップを行いました。評価ステップの無限値

function result = evaluate(estimated,depthTrue,number) 
    if(number == 1) 
    result = relative(estimated,depthTrue); 
    end 
    if (number == 2) 
     result = log10error(estimated,depthTrue); 
    end 
    if(number ==3) 
     result = rmse(estimated,depthTrue); 
    end 
end 




function result = relative(estimated,depthTrue) 
    result = mean(mean(abs(estimated - depthTrue)./depthTrue)); 
end 

function result = log10error(estimated,depthTrue) 
    result = mean(mean(abs(log10(estimated) - log10(depthTrue)))); 
end 

function result = rmse(estimated,depthTrue) 
    result = sqrt(mean(mean(abs(estimated - depthTrue).^2))); 
end 

画像で評価をしようとすると、無限大の値(log10errorと相対のみ)が得られます。検索後、私はその深さを発見し、推定値は0の値を持つことができます。

log10(0) 

ans = 

    -Inf 
5/0 

ans = 

    Inf 

どうすればよいですか?

答えて

0

私はこれを克服するためにいくつかのアプローチを考えることができますが、あなたのニーズに最も適しています。 infを無視するか、他の値に置き換えることができます。

depthTrue = rand(4); 
estimated = rand(4); 
estimated(1,1) = 0; 
% 1) ignore infs 
absdiff = abs(log10(estimated(:)) - log10(depthTrue(:))); 
result1 = mean(absdiff(~isinf(absdiff))) 
% 2) subtitute infs 
veryHighNumber = 1e5; 
absdiff(isinf(absdiff)) = veryHighNumber; 
result2 = mean(absdiff) 
% 3) subtitute zeros 
verySmallNumber = 1e-5; 
depthTrue(depthTrue == 0) = verySmallNumber; 
estimated(estimated == 0) = verySmallNumber; 
absdiff = abs(log10(estimated(:)) - log10(depthTrue(:))); 
result3 = mean(absdiff) 
+0

thnx sir、解決策が見つかりました。メートル(0は存在しません)の値を使用しました。 –

関連する問題