00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <stereo_wall_detection/ANN/ANN.h>
00030 #include <stereo_wall_detection/ANN/ANNperf.h>
00031
00032 using namespace std;
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 int ann_Ndata_pts = 0;
00048 int ann_Nvisit_lfs = 0;
00049 int ann_Nvisit_spl = 0;
00050 int ann_Nvisit_shr = 0;
00051 int ann_Nvisit_pts = 0;
00052 int ann_Ncoord_hts = 0;
00053 int ann_Nfloat_ops = 0;
00054 ANNsampStat ann_visit_lfs;
00055 ANNsampStat ann_visit_spl;
00056 ANNsampStat ann_visit_shr;
00057 ANNsampStat ann_visit_nds;
00058 ANNsampStat ann_visit_pts;
00059 ANNsampStat ann_coord_hts;
00060 ANNsampStat ann_float_ops;
00061
00062 ANNsampStat ann_average_err;
00063 ANNsampStat ann_rank_err;
00064
00065
00066
00067
00068
00069 DLL_API void annResetStats(int data_size)
00070 {
00071 ann_Ndata_pts = data_size;
00072 ann_visit_lfs.reset();
00073 ann_visit_spl.reset();
00074 ann_visit_shr.reset();
00075 ann_visit_nds.reset();
00076 ann_visit_pts.reset();
00077 ann_coord_hts.reset();
00078 ann_float_ops.reset();
00079 ann_average_err.reset();
00080 ann_rank_err.reset();
00081 }
00082
00083 DLL_API void annResetCounts()
00084 {
00085 ann_Nvisit_lfs = 0;
00086 ann_Nvisit_spl = 0;
00087 ann_Nvisit_shr = 0;
00088 ann_Nvisit_pts = 0;
00089 ann_Ncoord_hts = 0;
00090 ann_Nfloat_ops = 0;
00091 }
00092
00093 DLL_API void annUpdateStats()
00094 {
00095 ann_visit_lfs += ann_Nvisit_lfs;
00096 ann_visit_nds += ann_Nvisit_spl + ann_Nvisit_lfs;
00097 ann_visit_spl += ann_Nvisit_spl;
00098 ann_visit_shr += ann_Nvisit_shr;
00099 ann_visit_pts += ann_Nvisit_pts;
00100 ann_coord_hts += ann_Ncoord_hts;
00101 ann_float_ops += ann_Nfloat_ops;
00102 }
00103
00104
00105 void print_one_stat(const char *title, ANNsampStat s, double div)
00106 {
00107 cout << title << "= [ ";
00108 cout.width(9); cout << s.mean()/div << " : ";
00109 cout.width(9); cout << s.stdDev()/div << " ]<";
00110 cout.width(9); cout << s.min()/div << " , ";
00111 cout.width(9); cout << s.max()/div << " >\n";
00112 }
00113
00114 DLL_API void annPrintStats(
00115 ANNbool validate)
00116 {
00117 cout.precision(4);
00118 cout << " (Performance stats: "
00119 << " [ mean : stddev ]< min , max >\n";
00120 print_one_stat(" leaf_nodes ", ann_visit_lfs, 1);
00121 print_one_stat(" splitting_nodes ", ann_visit_spl, 1);
00122 print_one_stat(" shrinking_nodes ", ann_visit_shr, 1);
00123 print_one_stat(" total_nodes ", ann_visit_nds, 1);
00124 print_one_stat(" points_visited ", ann_visit_pts, 1);
00125 print_one_stat(" coord_hits/pt ", ann_coord_hts, ann_Ndata_pts);
00126 print_one_stat(" floating_ops_(K) ", ann_float_ops, 1000);
00127 if (validate) {
00128 print_one_stat(" average_error ", ann_average_err, 1);
00129 print_one_stat(" rank_error ", ann_rank_err, 1);
00130 }
00131 cout.precision(0);
00132 cout << " )\n";
00133 cout.flush();
00134 }