//----------------------------- int main(int argc, char** argv) //----------------------------- { // // Read options // ------------ if (argc != 3) { std::cout << "Usage: ./compare answer-file output-file\n" << std::endl; exit(1); } std::string answer_file = std::string(argv[1]); std::string output_file = std::string(argv[2]); // // Read grids // ---------- NRLib::StormContGrid * answer_grid = readStormGrid(answer_file); NRLib::StormContGrid * output_grid = readStormGrid(output_file); // // Check that grids are equal // -------------------------- bool equal = compareGridDefinitions(answer_grid, output_grid); // // Compare grids // ------------- float largest_difference = 0.0f; float mean_abs_difference = 0.0f; float mean_val_difference = 0.0f; float mean_val_both_cubes = 0.0f; compareGrids(answer_grid, output_grid, largest_difference, mean_abs_difference, mean_val_difference, mean_val_both_cubes); // // Write info to file for Perl import // ---------------------------------- std::string diff_file = "storm_volume_difference.txt"; writeDifferencesToFile(diff_file, equal, largest_difference, mean_abs_difference, mean_val_difference, mean_val_both_cubes); if (answer_grid != NULL) delete answer_grid; if (output_grid != NULL) delete output_grid; }
void GroundTruthEvaluation::evaluateEllipseFitter(taglist_t const& taglist) { // ToDo static const double threshold = 100.; GroundTruth::EllipseFitterEvaluationResults& results = _ellipsefitterResults; // copy ground truth grids from localizer results struct results.taggedGridsOnFrame = _localizerResults.taggedGridsOnFrame; // iterate over pipeline ROIs for (const pipeline::Tag& tag : taglist) { // find ground truth grid associated to current ROI auto it = _localizerResults.gridByTag.find(tag); // if valid iterator (and grid) if (it != _localizerResults.gridByTag.end()) { // get ground truth grid const std::shared_ptr<PipelineGrid>& grid = (*it).second; // if the pipeline ROI has ellipses if (!tag.getCandidatesConst().empty()) { // calculate similarity score (or distance measure?) // and store it in std::pair with the // ROI's ellipse auto scoreCandidatePair = compareGrids(tag, grid); // get the score const double score = scoreCandidatePair.first; // get the ellipse const pipeline::TagCandidate& candidate = scoreCandidatePair.second; // store the ROI-ellipse pair if match (why that way?) if (score <= threshold) results.truePositives.push_back( { tag, candidate }); else // store as false detection results.falsePositives.insert(tag); } // if no ellipses are found by pipeline, // this tag (ROI) is counted as a missing detection else results.falseNegatives.insert(grid); } // there is no ground truth data for the specified ROI // --> also count it as a false detection else if (tag.getCandidatesConst().size()) { results.falsePositives.insert(tag); } } // mark all ground truth grids that the localizer wasn't able to find // as missing detections on the ellipsefitter layer as well for (const std::shared_ptr<PipelineGrid>& grid : _localizerResults.falseNegatives) { results.falseNegatives.insert(grid); } }