32 #ifndef EVALUATION_SUMMARY_H 33 #define EVALUATION_SUMMARY_H 36 #include <boost/filesystem.hpp> 37 #include <opencv2/opencv.hpp> 70 return contour || random || perturbed_mean || mean || pre_rec ||
ue;
78 ue_np(true), ue_levin(true), asa(true), sse_rgb(true), sse_xy(true),
79 co(true), ev(true), mde(true), icv(true), cd(true),
80 reg(true), sp(true), sp_size(true) {};
123 min_and_max(true), mid_range(true), std(true) {};
240 void evaluateHeader(std::stringstream &output, std::vector<std::string> &metric_order);
249 void evaluate(
const cv::Mat &sp_segmentation,
const cv::Mat >_segmentation,
250 const cv::Mat &image, cv::Mat &data, std::stringstream &output);
259 void visualize(
const cv::Mat &sp_segmentation,
const cv::Mat >_segmentation,
260 const cv::Mat &image, std::string name,
int t = 0);
268 void correlate(
const cv::Mat &mat_results,
const std::vector<std::string> &metric_order,
269 cv::Mat &mat_correlation, std::string &csv_correlation);
284 void summaryHeader(
const std::vector<int> >, std::stringstream &output);
294 void summarize(
const std::vector<int> >,
const cv::Mat &data,
295 int j, cv::Mat &mat_summary, std::stringstream &output);
305 float computeMean(
const std::vector<int> gt,
const cv::Mat &data,
int j,
306 std::vector<float> &
mean,
float &mean_min,
float &mean_max);
316 float comuteMedian(
const std::vector<int> gt,
const cv::Mat &data,
int j,
317 std::vector<float> &median,
float &median_min,
float &median_max);
334 std::vector<float> &median, std::vector<float> &first_q, std::vector<float> &thrid_q,
335 float &median_min,
float &first_q_min,
float &third_q_min,
float &median_max,
336 float &first_q_max,
float &second_q_max);
349 void comuteMinMax(
const std::vector<int> gt,
const cv::Mat &data,
int j,
350 std::vector<float> &min, std::vector<float> &max,
float &min_min,
351 float &max_min,
float &min_max,
float&max_max);
363 const std::vector<float> &
mean, std::vector<float> &std,
float &std_min,
bool sp
Whether to compute the number of superpixels.
Definition: evaluation_summary.h:113
bool oe
Whether to use Oversegmentation Error.
Definition: evaluation_summary.h:85
void summarize(const std::vector< int > >, const cv::Mat &data, int j, cv::Mat &mat_summary, std::stringstream &output)
Summarize a specific column of the evaluation data (corresponding to a particular metric)...
Definition: evaluation_summary.cpp:635
bool sp_size
Whether to compute superpixel size.
Definition: evaluation_summary.h:115
bool pre_rec
Whether to visualize false positives and negatives in the Recall/Precision sense. ...
Definition: evaluation_summary.h:62
Available superpixel visualizations, see visualization.h.
Definition: evaluation_summary.h:49
bool ev
Whether to use Explained Variation.
Definition: evaluation_summary.h:103
bool sse_xy
Whether to use the sum-of-squared error on xy coordinates.
Definition: evaluation_summary.h:99
bool mid_range
Whether to compute the mid range.
Definition: evaluation_summary.h:132
boost::filesystem::path summary_file
Path to summary file.
Definition: evaluation_summary.h:387
void getSuperpixelVisualizations(EvaluationSummary::SuperpixelVisualizations &superpixel_visualizations)
Get the visualizations used.
Definition: evaluation_summary.cpp:1380
void getEvaluationStatistics(EvaluationSummary::EvaluationStatistics &evaluation_statistics)
Get the evaluation statistics used.
Definition: evaluation_summary.cpp:1364
EvaluationMetrics evaluation_metrics
Evaluation metrics to use.
Definition: evaluation_summary.h:367
bool pre
Whether to use Boundary Precision.
Definition: evaluation_summary.h:89
SuperpixelVisualizations()
Definition: evaluation_summary.h:50
bool std
Whether to compute the standard deviation.
Definition: evaluation_summary.h:134
void computeSummary(int >_max)
Summarize the results; this is the main entrance point.
Definition: evaluation_summary.cpp:1137
Available metrics, see evaluation.h.
Definition: evaluation_summary.h:76
void setAppendFile(const boost::filesystem::path &append_file)
Add CSV file to append CSV output to.
Definition: evaluation_summary.cpp:1332
boost::filesystem::path correlation_file
Path to correlation file.
Definition: evaluation_summary.h:385
bool rec
WHether to use Boundary Recal.
Definition: evaluation_summary.h:87
void setEvaluationStatistics(const EvaluationStatistics &evaluation_statistics)
Set the evaluation statistics to compute.
Definition: evaluation_summary.cpp:1340
bool mde
Whether to use Mean Distance to Edge.
Definition: evaluation_summary.h:105
void setEvaluationMetrics(const EvaluationMetrics &evaluation_metrics)
Set the evaluation metrics to compute.
Definition: evaluation_summary.cpp:1348
Available statistics that may be computed for each metric.
Definition: evaluation_summary.h:120
void evaluateHeader(std::stringstream &output, std::vector< std::string > &metric_order)
Add header to output.
Definition: evaluation_summary.cpp:165
bool icv
Whether to use Intra-Cluster Variation.
Definition: evaluation_summary.h:107
boost::filesystem::path gt_directory
Directory of ground truth segmentations.
Definition: evaluation_summary.h:379
float computeMean(const std::vector< int > gt, const cv::Mat &data, int j, std::vector< float > &mean, float &mean_min, float &mean_max)
Compute mean statistic.
Definition: evaluation_summary.cpp:809
bool mean
Whether to visualize superpixels using mean color.
Definition: evaluation_summary.h:60
bool sse_rgb
Whether to use the sum-of-squared error on RGB color.
Definition: evaluation_summary.h:97
void evaluate(const cv::Mat &sp_segmentation, const cv::Mat >_segmentation, const cv::Mat &image, cv::Mat &data, std::stringstream &output)
Actually do the evaluation.
Definition: evaluation_summary.cpp:247
bool cd
Whether to use Contour Density.
Definition: evaluation_summary.h:109
bool any()
Decide if any visualization is requested.
Definition: evaluation_summary.h:69
void setComputeCorrelation(bool compute_correlation)
Set whether to compute correlation.
Definition: evaluation_summary.cpp:1388
bool getComputeCorrelation()
Get whether correlation is computed.
Definition: evaluation_summary.cpp:1396
boost::filesystem::path sp_directory
Directory of superpixel segmentations.
Definition: evaluation_summary.h:377
void visualize(const cv::Mat &sp_segmentation, const cv::Mat >_segmentation, const cv::Mat &image, std::string name, int t=0)
Visualize given segmentation.
Definition: evaluation_summary.cpp:429
void summaryHeader(const std::vector< int > >, std::stringstream &output)
Add the summary header to output.
Definition: evaluation_summary.cpp:578
void comuteMedianFirstAndThirdQuartile(const std::vector< int > gt, const cv::Mat &data, int j, std::vector< float > &median, std::vector< float > &first_q, std::vector< float > &thrid_q, float &median_min, float &first_q_min, float &third_q_min, float &median_max, float &first_q_max, float &second_q_max)
Compute median, first quartile and third quartile.
Definition: evaluation_summary.cpp:892
bool ue_levin
Whether to use Levinshtein's definition of the Undersegmentation Error.
Definition: evaluation_summary.h:93
bool reg
Whether to use Regularity.
Definition: evaluation_summary.h:111
float comuteMedian(const std::vector< int > gt, const cv::Mat &data, int j, std::vector< float > &median, float &median_min, float &median_max)
Compute median statistic.
void validateStatistics()
Validate and correct statistics.
Definition: evaluation_summary.cpp:565
boost::filesystem::path results_file
Path to results file.
Definition: evaluation_summary.h:383
bool min_and_max
Compute minimum and maximum over all images.
Definition: evaluation_summary.h:130
bool ue
Whether to use Undersegmentation Error.
Definition: evaluation_summary.h:80
bool ue
Whether to color the undersegmentation error.
Definition: evaluation_summary.h:64
SuperpixelVisualizations superpixel_visualizations
Visualizations to compute.
Definition: evaluation_summary.h:371
boost::filesystem::path img_directory
Directory of images.
Definition: evaluation_summary.h:381
bool co
Whether to use Compactness.
Definition: evaluation_summary.h:101
void comuteMinMax(const std::vector< int > gt, const cv::Mat &data, int j, std::vector< float > &min, std::vector< float > &max, float &min_min, float &max_min, float &min_max, float &max_max)
Compute min/max over all ground truth segmentations.
Definition: evaluation_summary.cpp:984
bool contour
Whether to visualize contours.
Definition: evaluation_summary.h:51
bool median_and_quartiles
Compute median, first and third quantile over all images.
Definition: evaluation_summary.h:128
EvaluationMetrics()
Definition: evaluation_summary.h:77
bool random
Whether to visualize superpixels as randomly colored.
Definition: evaluation_summary.h:56
EvaluationSummary(boost::filesystem::path sp_directory, boost::filesystem::path gt_directory, boost::filesystem::path img_directory)
Create an evaluation summary for the given directory.
Definition: evaluation_summary.cpp:45
bool asa
Whether to use Achievable Segmentation Accuracy.
Definition: evaluation_summary.h:95
bool ue_np
Whether to use Neubert and Protzel's definition of the Undersegmentation Error.
Definition: evaluation_summary.h:91
void getEvaluationMetrics(EvaluationSummary::EvaluationMetrics &evaluation_metrics)
Get the evaluation metrics used.
Definition: evaluation_summary.cpp:1372
boost::filesystem::path append_file
Path to file to append summary to.
Definition: evaluation_summary.h:391
float computeStandardDeviation(const std::vector< int > gt, const cv::Mat &data, int j, const std::vector< float > &mean, std::vector< float > &std, float &std_min, float &std_max)
Compute standard deviation over all ground truth segmentations.
Definition: evaluation_summary.cpp:1051
bool perturbed_mean
Whether to visualize superpixels using a slightly perturbed mean color.
Definition: evaluation_summary.h:58
boost::filesystem::path vis_directory
Path to visualization directory.
Definition: evaluation_summary.h:389
int countStatistics(int gt_max)
Count the number of statistics to be used.
Definition: evaluation_summary.cpp:541
bool mean
Compute the mean over all images.
Definition: evaluation_summary.h:123
EvaluationStatistics evaluation_statistics
Evaluation statistics to use.
Definition: evaluation_summary.h:369
Given a directory of superpixel segmentations and a directory of ground truth segmentations, this class is used to generate a CSV file of statistics of different metrics.
Definition: evaluation_summary.h:44
void setSuperpixelVisualizations(const SuperpixelVisualizations &superpixel_visualizations)
Set the superpixel visualizations to compute.
Definition: evaluation_summary.cpp:1356
EvaluationStatistics()
Definition: evaluation_summary.h:122
void correlate(const cv::Mat &mat_results, const std::vector< std::string > &metric_order, cv::Mat &mat_correlation, std::string &csv_correlation)
Compute correlation between all metrics.
Definition: evaluation_summary.cpp:478
int countMetrics()
Count number of metrics used.
Definition: evaluation_summary.cpp:102
bool compute_correlation
Whether to compute correlation.
Definition: evaluation_summary.h:374