Superpixel Benchmark
Superpixel benchmark, tools and algorithms.
|
Tool to guide parameter optimization using grid search. More...
#include <parameter_optimization_tool.h>
Public Member Functions | |
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. More... | |
void | addPostProcessingCommandLine (std::string command_line) |
Add post-processing script (e.g. boundaries to segmentation conversion) which is applied on the CSV segmentation output of the algorithms. More... | |
void | addSuperpixelTolerance (int superpixels, int tolerance) |
Some algorithms do not allow to control superpixels, therefore, optimization may aim for a specific range of superpixel numbers. More... | |
void | addFloatParameter (std::string name, std::string parameter, std::vector< float > values) |
Add float parameter to optimize. More... | |
void | addIntegerParameter (std::string name, std::string parameter, std::vector< int > values) |
Add integer parameter to optimize. More... | |
void | useDepth (boost::filesystem::path depth_directory) |
Use depth as additional cue. More... | |
void | useIntrinsics (boost::filesystem::path intrinsics_directory) |
Use intrinsic parameters from given directory for depth. More... | |
void | setVerbose (std::ostream &stream=std::cout) |
Set parameter optimization verbose. Per default output is written to std::cout. More... | |
int | numCombinations () |
Count parameter combinations. More... | |
void | optimize (float weigh=0.5, float weight_ue=0.33, float weight_co=0.33) |
Jointly optimize for Boundary Recall and Undersegmentation Error. More... | |
Static Public Attributes | |
static const int | FLOAT_PARAMETER = 1 |
Constant to indicate a float parameter. More... | |
static const int | INTEGER_PARAMETER = 2 |
Constant to indicate an integer parameter. More... | |
Protected Member Functions | |
void | cleanUp (const boost::filesystem::path &sp_directory) |
Removes all unnecessary CSV files in base folder. More... | |
Protected Attributes | |
std::string | command_line |
The command used to runt he algorithm. More... | |
std::string | command_line_parameters |
Command line parameters always to append. More... | |
std::string | post_processing_command_line |
Command to use for post-processing. More... | |
boost::filesystem::path | img_directory |
Directory containing the images. More... | |
boost::filesystem::path | gt_directory |
Directory containing the ground truth segmentations. More... | |
boost::filesystem::path | depth_directory |
Directory containing the depth images. More... | |
boost::filesystem::path | intrinsics_directory |
Directory containing the intrinsic parameters for each image. More... | |
boost::filesystem::path | base_directory |
Base directory to optimize parameters in and put temporary files. More... | |
EvaluationSummary::EvaluationMetrics | evaluation_metrics |
Evaluation metrics to use. More... | |
EvaluationSummary::EvaluationStatistics | evaluation_statistics |
Evaluation statistics to use. More... | |
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. More... | |
std::vector< std::tuple< std::vector< int >, int, int, int > > | integer_parameters |
Vector containing all integer parameters. More... | |
std::vector< std::tuple< std::vector< float >, int, float, float > > | float_parameters |
Vector containing all float parameters. More... | |
int | superpixels_min |
Minimum number of superpixels. More... | |
int | superpixels_max |
Tool to guide parameter optimization using grid search.
Copyright (c) 2016, David Stutz Contact: david, davidstutz.de All rights reserved. .stu tz@rw th-a achen .de
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ParameterOptimizationTool::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.
The command line tool to use has to provide several options, including -i to specify the input directory, -o to specify the CV output directory, -d for depth directory. See README.md for details.
[in] | img_directory | directory containing the images |
[in] | gt_directory | directories containing the ground truth segmentations |
[in] | base_directory | base directory to operate in, i.e. save superpixel labels and summaries |
[in] | command_line | command to use to run the algorithm to optimize prameters for |
[in] | command_line_parameters | command line parameters to use with each run. |
void ParameterOptimizationTool::addFloatParameter | ( | std::string | name, |
std::string | parameter, | ||
std::vector< float > | values | ||
) |
Add float parameter to optimize.
[in] | name | name of the parameter |
[in] | parameter | parameter for the command line |
[in] | values | vector of values to consider |
void ParameterOptimizationTool::addIntegerParameter | ( | std::string | name, |
std::string | parameter, | ||
std::vector< int > | values | ||
) |
Add integer parameter to optimize.
[in] | name | name of the parameter |
[in] | parameter | parameter for the command line |
[in] | values | vector of values to consider |
void ParameterOptimizationTool::addPostProcessingCommandLine | ( | std::string | command_line | ) |
Add post-processing script (e.g. boundaries to segmentation conversion) which is applied on the CSV segmentation output of the algorithms.
[in] | command_line | command used for post processing, it is called with -i for the superpixel labels directory and -m for the image directory |
void ParameterOptimizationTool::addSuperpixelTolerance | ( | int | superpixels, |
int | tolerance | ||
) |
Some algorithms do not allow to control superpixels, therefore, optimization may aim for a specific range of superpixel numbers.
[in] | superpixels | desired number of superpixels |
[in] | tolerance | number of superpixels we allow to deviate from the desired number |
|
protected |
Removes all unnecessary CSV files in base folder.
[in] | so_directory | clean up the directory containing the superpixel labels |
int ParameterOptimizationTool::numCombinations | ( | ) |
Count parameter combinations.
void ParameterOptimizationTool::optimize | ( | float | weigh = 0.5 , |
float | weight_ue = 0.33 , |
||
float | weight_co = 0.33 |
||
) |
Jointly optimize for Boundary Recall and Undersegmentation Error.
[in] | weight | weight between boundary recall and undersegmentation error |
[in] | weight_ue | alternative (secondary) optimization weight for undersegmentation error |
[in] | weight_co | alternative (secondary) optimization weight for compactness |
void ParameterOptimizationTool::setVerbose | ( | std::ostream & | stream = std::cout | ) |
Set parameter optimization verbose. Per default output is written to std::cout.
[in] | stream | stream to output to |
void ParameterOptimizationTool::useDepth | ( | boost::filesystem::path | depth_directory | ) |
Use depth as additional cue.
[in] | depth_directory | directory containing depth files |
void ParameterOptimizationTool::useIntrinsics | ( | boost::filesystem::path | intrinsics_directory | ) |
Use intrinsic parameters from given directory for depth.
[in] | intrinsics_directory | directory containing the intrinsic parameters of each image |
|
protected |
Base directory to optimize parameters in and put temporary files.
|
protected |
The command used to runt he algorithm.
|
protected |
Command line parameters always to append.
|
protected |
Directory containing the depth images.
|
protected |
Evaluation metrics to use.
|
protected |
Evaluation statistics to use.
|
static |
Constant to indicate a float parameter.
|
protected |
Vector containing all float parameters.
|
protected |
Directory containing the ground truth segmentations.
|
protected |
Directory containing the images.
|
static |
Constant to indicate an integer parameter.
|
protected |
Vector containing all integer parameters.
|
protected |
Directory containing the intrinsic parameters for each image.
|
protected |
The parameters, with name, command line parameter, type and index in the respective vector.
|
protected |
Command to use for post-processing.
|
protected |
brief Maximum number of superpixels.
|
protected |
Minimum number of superpixels.