Added padding to benchmark results output

This commit is contained in:
Matt Hill
2015-07-01 23:17:58 -04:00
parent 57e4b220a4
commit 2ab8c35e9c

View File

@@ -116,15 +116,25 @@ void EndToEndTest::runTest(string country, vector<std::string> files)
// Print results data // Print results data
int image_name_padding = 0;
for (int i = 0; i < benchmarkResults.size(); i++)
{
EndToEndBenchmarkResult br = benchmarkResults[i];
if (br.imageName.length() > image_name_padding)
image_name_padding = br.imageName.length();
}
image_name_padding += 4;
ofstream data; ofstream data;
string outputResultsFile = outputDir + "/results.txt"; string outputResultsFile = outputDir + "/results.txt";
data.open(outputResultsFile.c_str()); data.open(outputResultsFile.c_str());
data << "Image name Detected Plate # False Detections Top Result Correct Top 10 Correct # False Results" << endl;
data << setfill(' ') << setw(image_name_padding) << "Image name" << setw(20) << "Detected Plate" << setw(20) << "# False Detections" << setw(20) << "Top Result Correct" << setw(20) << "Top 10 Correct" << setw(20) << "# False Results" << endl;
for (int i = 0; i < benchmarkResults.size(); i++) for (int i = 0; i < benchmarkResults.size(); i++)
{ {
EndToEndBenchmarkResult br = benchmarkResults[i]; EndToEndBenchmarkResult br = benchmarkResults[i];
data << br.imageName << "\t" << br.detectedPlate << "\t" << br.detectionFalsePositives << "\t" << br.topResultCorrect << "\t" << br.top10ResultCorrect << "\t" << br.resultsFalsePositives << endl; data << setfill(' ') << setw(image_name_padding) << br.imageName << setw(20) << br.detectedPlate << setw(20) << br.detectionFalsePositives << setw(20) << br.topResultCorrect << setw(20) << br.top10ResultCorrect << setw(20) << br.resultsFalsePositives << endl;
} }
data.close(); data.close();