Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

single-image-test: added accuracy workaround for computing CPU reference and adjust the NRMSE and PSNR metrics (#26020)

Andrei Beleiucddcfe83c6f7
diff --git a/src/plugins/intel_npu/tools/single-image-test/main.cpp b/src/plugins/intel_npu/tools/single-image-test/main.cpp
index 3b3009bb5f4..4018982b022 100644
--- a/src/plugins/intel_npu/tools/single-image-test/main.cpp
+++ b/src/plugins/intel_npu/tools/single-image-test/main.cpp
@@ -1200,7 +1200,8 @@ bool computeRRMSE(const ov::Tensor& output, const ov::Tensor& reference) {
double rrmseLoss = sqrt(error / sum);
- std::cout << "RRMSE loss : " << rrmseLoss << " RRMSE threshold : " << FLAGS_rrmse_loss_threshold << std::endl;
+ std::cout << "RRMSE loss : " << std::fixed << std::setprecision(4) << rrmseLoss
+ << " RRMSE threshold : " << FLAGS_rrmse_loss_threshold << std::endl;
return rrmseLoss <= FLAGS_rrmse_loss_threshold;
}
@@ -1267,7 +1268,8 @@ bool computeNRMSE(const ov::Tensor& output, const ov::Tensor& reference) {
double nrmseLoss =
sqrt(error / size) / std::max(0.001f, std::max(maxOutput - minOutput, maxReference - minReference));
- std::cout << "NRMSE loss : " << nrmseLoss << " NRMSE threshold : " << FLAGS_nrmse_loss_threshold << std::endl;
+ std::cout << "NRMSE loss : " << std::fixed << std::setprecision(4) << nrmseLoss
+ << " NRMSE threshold : " << FLAGS_nrmse_loss_threshold << std::endl;
return nrmseLoss <= FLAGS_nrmse_loss_threshold;
}
@@ -1319,7 +1321,7 @@ bool testPSNR(const TensorMap& outputs, const TensorMap& references, const int d
auto result = utils::runPSNRMetric(actOutput, refOutput, dstHeight, dstWidth, scaleBorder, normalizedImage);
- if (std::fabs(result - FLAGS_psnr_reference) > FLAGS_psnr_tolerance) {
+ if (FLAGS_psnr_reference - result > FLAGS_psnr_tolerance) {
std::cout << "Absolute difference between actual value " << result << " and reference value "
<< FLAGS_psnr_reference << " larger then tolerance " << FLAGS_psnr_tolerance << std::endl;
return false;