Superpixel Benchmark
Superpixel benchmark, tools and algorithms.
parameter_optimization_tool.h
Go to the documentation of this file.
1 
32 #ifndef PARAMETER_OPTIMIZATION_TOOL_H
33 #define PARAMETER_OPTIMIZATION_TOOL_H
34 
35 #include <tuple>
36 #include "evaluation_summary.h"
37 
42 public:
43 
45  static const int FLOAT_PARAMETER = 1;
47  static const int INTEGER_PARAMETER = 2;
48 
61  ParameterOptimizationTool(boost::filesystem::path img_directory,
62  boost::filesystem::path gt_directory, boost::filesystem::path base_directory,
63  std::string command_line, std::string command_line_parameters);
64 
70 
76  void addSuperpixelTolerance(int superpixels, int tolerance);
77 
83  void addFloatParameter(std::string name, std::string parameter,
84  std::vector<float> values);
85 
91  void addIntegerParameter(std::string name, std::string parameter,
92  std::vector<int> values);
93 
97  void useDepth(boost::filesystem::path depth_directory);
98 
102  void useIntrinsics(boost::filesystem::path intrinsics_directory);
103 
108  void setVerbose(std::ostream &stream = std::cout);
109 
113  int numCombinations();
114 
120  void optimize(float weigh = 0.5, float weight_ue = 0.33, float weight_co = 0.33);
121 
122 protected:
123 
127  void cleanUp(const boost::filesystem::path &sp_directory);
128 
130  std::string command_line;
135 
137  boost::filesystem::path img_directory;
139  boost::filesystem::path gt_directory;
141  boost::filesystem::path depth_directory;
143  boost::filesystem::path intrinsics_directory;
145  boost::filesystem::path base_directory;
146 
151 
153  std::vector< std::tuple<std::string, std::string, int, int> > parameters;
155  std::vector< std::tuple<std::vector<int>, int, int, int> > integer_parameters;
157  std::vector< std::tuple<std::vector<float>, int, float, float> > float_parameters;
158 
163 
164 };
165 
166 #endif /* PARAMETER_OPTIMIZATION_TOOL_H */
167 
void optimize(float weigh=0.5, float weight_ue=0.33, float weight_co=0.33)
Jointly optimize for Boundary Recall and Undersegmentation Error.
Definition: parameter_optimization_tool.cpp:216
void setVerbose(std::ostream &stream=std::cout)
Set parameter optimization verbose. Per default output is written to std::cout.
void cleanUp(const boost::filesystem::path &sp_directory)
Removes all unnecessary CSV files in base folder.
Definition: parameter_optimization_tool.cpp:607
std::vector< std::tuple< std::vector< int >, int, int, int > > integer_parameters
Vector containing all integer parameters.
Definition: parameter_optimization_tool.h:155
Available metrics, see evaluation.h.
Definition: evaluation_summary.h:76
void addSuperpixelTolerance(int superpixels, int tolerance)
Some algorithms do not allow to control superpixels, therefore, optimization may aim for a specific r...
Definition: parameter_optimization_tool.cpp:95
EvaluationSummary::EvaluationStatistics evaluation_statistics
Evaluation statistics to use.
Definition: parameter_optimization_tool.h:150
Available statistics that may be computed for each metric.
Definition: evaluation_summary.h:120
int superpixels_max
Definition: parameter_optimization_tool.h:162
std::string command_line_parameters
Command line parameters always to append.
Definition: parameter_optimization_tool.h:132
int numCombinations()
Count parameter combinations.
Definition: parameter_optimization_tool.cpp:184
static const int FLOAT_PARAMETER
Constant to indicate a float parameter.
Definition: parameter_optimization_tool.h:45
void addPostProcessingCommandLine(std::string command_line)
Add post-processing script (e.g. boundaries to segmentation conversion) which is applied on the CSV s...
Definition: parameter_optimization_tool.cpp:87
ParameterOptimizationTool(boost::filesystem::path img_directory, boost::filesystem::path gt_directory, boost::filesystem::path base_directory, std::string command_line, std::string command_line_parameters)
Constructor.
Definition: parameter_optimization_tool.cpp:48
boost::filesystem::path gt_directory
Directory containing the ground truth segmentations.
Definition: parameter_optimization_tool.h:139
std::string command_line
The command used to runt he algorithm.
Definition: parameter_optimization_tool.h:130
std::vector< std::tuple< std::string, std::string, int, int > > parameters
The parameters, with name, command line parameter, type and index in the respective vector...
Definition: parameter_optimization_tool.h:153
int superpixels_min
Minimum number of superpixels.
Definition: parameter_optimization_tool.h:160
boost::filesystem::path depth_directory
Directory containing the depth images.
Definition: parameter_optimization_tool.h:141
boost::filesystem::path base_directory
Base directory to optimize parameters in and put temporary files.
Definition: parameter_optimization_tool.h:145
void addFloatParameter(std::string name, std::string parameter, std::vector< float > values)
Add float parameter to optimize.
Definition: parameter_optimization_tool.cpp:104
boost::filesystem::path intrinsics_directory
Directory containing the intrinsic parameters for each image.
Definition: parameter_optimization_tool.h:143
void addIntegerParameter(std::string name, std::string parameter, std::vector< int > values)
Add integer parameter to optimize.
Definition: parameter_optimization_tool.cpp:136
void useIntrinsics(boost::filesystem::path intrinsics_directory)
Use intrinsic parameters from given directory for depth.
Definition: parameter_optimization_tool.cpp:176
void useDepth(boost::filesystem::path depth_directory)
Use depth as additional cue.
Definition: parameter_optimization_tool.cpp:168
EvaluationSummary::EvaluationMetrics evaluation_metrics
Evaluation metrics to use.
Definition: parameter_optimization_tool.h:148
static const int INTEGER_PARAMETER
Constant to indicate an integer parameter.
Definition: parameter_optimization_tool.h:47
Tool to guide parameter optimization using grid search.
Definition: parameter_optimization_tool.h:41
std::string post_processing_command_line
Command to use for post-processing.
Definition: parameter_optimization_tool.h:134
std::vector< std::tuple< std::vector< float >, int, float, float > > float_parameters
Vector containing all float parameters.
Definition: parameter_optimization_tool.h:157
boost::filesystem::path img_directory
Directory containing the images.
Definition: parameter_optimization_tool.h:137