Commit 0de865d9 authored by Andrey Filippov's avatar Andrey Filippov

Added average RMSE fro orientation

parent 7c17ebab
...@@ -7591,8 +7591,9 @@ public class OpticalFlow { ...@@ -7591,8 +7591,9 @@ public class OpticalFlow {
Arrays.fill(dbg_rms_pre, Double.NaN); Arrays.fill(dbg_rms_pre, Double.NaN);
// process scenes before reference // process scenes before reference
int dbg_ref_index = 10; // wait for ref_index <= dbg_ref_index and print (manually update dbg_ref_index int dbg_ref_index = 10; // wait for ref_index <= dbg_ref_index and print (manually update dbg_ref_index
double maximal_series_rms = 0.0; RMSEStats rmse_stats = new RMSEStats();
double maximal_series_rms1 = 0.0; RMSEStats rmse_stats1 = new RMSEStats();
if (ref_index > 1) { if (ref_index > 1) {
for (int i = ref_index - 2; i >= 0 ; i--) { for (int i = ref_index - 2; i >= 0 ; i--) {
QuadCLT scene_QuadClt = scenes[i]; QuadCLT scene_QuadClt = scenes[i];
...@@ -7672,9 +7673,7 @@ public class OpticalFlow { ...@@ -7672,9 +7673,7 @@ public class OpticalFlow {
} }
} }
} }
if (lma_rms[0] > maximal_series_rms) { rmse_stats.add(lma_rms[0]);
maximal_series_rms = lma_rms[0];
}
dbg_rms_pre[i] = lma_rms[0]; dbg_rms_pre[i] = lma_rms[0];
ers_reference.addScene(scene_QuadClt.getImageName(), ers_reference.addScene(scene_QuadClt.getImageName(),
scenes_xyzatr[i][0], scenes_xyzatr[i][0],
...@@ -7691,8 +7690,8 @@ public class OpticalFlow { ...@@ -7691,8 +7690,8 @@ public class OpticalFlow {
if (debug_level > -1) { if (debug_level > -1) {
System.out.println("Pass multi scene "+i+" (of "+ scenes.length+") "+ System.out.println("Pass multi scene "+i+" (of "+ scenes.length+") "+
reference_QuadClt.getImageName() + "/" + scene_QuadClt.getImageName()+ reference_QuadClt.getImageName() + "/" + scene_QuadClt.getImageName()+
" Done. RMS="+lma_rms[0]+", maximal so far was "+maximal_series_rms); " Done. RMS="+lma_rms[0]+
} ", maximal so far was "+rmse_stats.getMax()+", average was "+rmse_stats.getAverage()); }
if (delete_scene_asap) { if (delete_scene_asap) {
scenes[i+1] = null; scenes[i+1] = null;
} }
...@@ -7775,9 +7774,7 @@ public class OpticalFlow { ...@@ -7775,9 +7774,7 @@ public class OpticalFlow {
0.0, // double max_rms, 0.0, // double max_rms,
debug_level); // int debug_level) debug_level); // int debug_level)
} }
if (lma_rms[0] > maximal_series_rms) { rmse_stats.add(lma_rms[0]);
maximal_series_rms = lma_rms[0];
}
dbg_rms_pre[i] = lma_rms[0]; dbg_rms_pre[i] = lma_rms[0];
ers_reference.addScene(scene_QuadClt.getImageName(), ers_reference.addScene(scene_QuadClt.getImageName(),
scenes_xyzatr[i][0], scenes_xyzatr[i][0],
...@@ -7794,7 +7791,8 @@ public class OpticalFlow { ...@@ -7794,7 +7791,8 @@ public class OpticalFlow {
if (debug_level > -1) { if (debug_level > -1) {
System.out.println("Pass multi scene "+i+" (of "+ scenes.length+") "+ System.out.println("Pass multi scene "+i+" (of "+ scenes.length+") "+
reference_QuadClt.getImageName() + "/" + scene_QuadClt.getImageName()+ reference_QuadClt.getImageName() + "/" + scene_QuadClt.getImageName()+
" Done. RMS="+lma_rms[0]+", maximal so far was "+maximal_series_rms); " Done. RMS="+lma_rms[0]+
", maximal so far was "+rmse_stats.getMax()+", average was "+rmse_stats.getAverage());
} }
if (delete_scene_asap) { if (delete_scene_asap) {
scenes[i-1] = null; scenes[i-1] = null;
...@@ -7802,7 +7800,7 @@ public class OpticalFlow { ...@@ -7802,7 +7800,7 @@ public class OpticalFlow {
} }
} }
if (debug_level > -3) { if (debug_level > -3) {
System.out.println("All multi scene passes are Done. Maximal RMSE was "+maximal_series_rms); System.out.println("All multi scene passes are Done. Maximal RMSE was "+rmse_stats.getMax()+", average was "+rmse_stats.getAverage());
} }
// boolean show_results = true; // boolean show_results = true;
...@@ -7922,9 +7920,7 @@ public class OpticalFlow { ...@@ -7922,9 +7920,7 @@ public class OpticalFlow {
0.0, // double max_rms, 0.0, // double max_rms,
debug_level); // int debug_level) debug_level); // int debug_level)
} }
if (lma_rms[0] > maximal_series_rms1) { rmse_stats1.add(lma_rms[0]);
maximal_series_rms1 = lma_rms[0];
}
dbg_rms[i] = lma_rms[0]; dbg_rms[i] = lma_rms[0];
ers_reference.addScene( ers_reference.addScene(
scene_ts, scene_ts,
...@@ -7944,7 +7940,8 @@ public class OpticalFlow { ...@@ -7944,7 +7940,8 @@ public class OpticalFlow {
if (debug_level > -1) { if (debug_level > -1) {
System.out.println("Pass 2 multi scene "+i+" (of "+ scenes.length+") "+ System.out.println("Pass 2 multi scene "+i+" (of "+ scenes.length+") "+
reference_QuadClt.getImageName() + "/" + scene_ts+ reference_QuadClt.getImageName() + "/" + scene_ts+
" Done. RMS="+lma_rms[0]+", maximal so far was "+maximal_series_rms); " Done. RMS="+lma_rms[0]+
", maximal so far was "+rmse_stats.getMax()+", average was "+rmse_stats.getAverage());
} }
if (delete_scene_asap) { if (delete_scene_asap) {
scenes[i-1] = null; scenes[i-1] = null;
...@@ -7965,7 +7962,7 @@ public class OpticalFlow { ...@@ -7965,7 +7962,7 @@ public class OpticalFlow {
rms_mean /= rms_num; rms_mean /= rms_num;
if (debug_level > -3) { if (debug_level > -3) {
System.out.println("adjustSeries() rms_pre_mean="+rms_pre_mean+", rms_mean="+ System.out.println("adjustSeries() rms_pre_mean="+rms_pre_mean+", rms_mean="+
rms_mean+", maximal RMSE="+maximal_series_rms1); rms_mean+", maximal RMSE="+rmse_stats1.getMax()+", average was "+rmse_stats1.getAverage());
} }
if (show_results) { if (show_results) {
...@@ -8125,8 +8122,8 @@ public class OpticalFlow { ...@@ -8125,8 +8122,8 @@ public class OpticalFlow {
8); // int iscale) // 8 8); // int iscale) // 8
} }
if (debug_level > -3) { if (debug_level > -3) {
System.out.println("adjustSeries() Done. Maximal RMSE in pass1 was "+maximal_series_rms+ System.out.println("adjustSeries() Done. Maximal RMSE in pass1 was "+rmse_stats.getMax()+", average was "+rmse_stats.getAverage()+
", in pass2 - "+maximal_series_rms1); ", in pass2 - "+rmse_stats1.getMax()+", average was "+rmse_stats1.getAverage());
} }
} }
......
package com.elphel.imagej.tileprocessor;
public class RMSEStats {
public double max = 0;
public double sum2 = 0;
public int num = 0;
public void add(double rmse) {
sum2 += rmse*rmse;
num++;
max = Math.max(max, rmse);
}
public double getMax() {
return max;
}
public int getNum() {
return num;
}
public double getAverage() {
return Math.sqrt(sum2/num);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment