Classes | Public Member Functions | Private Member Functions | Private Attributes
Learning Class Reference

Train and use an SVM to predict antipodal grasps. More...

#include <learning.h>

List of all members.

Classes

struct  Instance
 Learning instance representing a grasp hypothesis. More...
struct  UniqueVectorComparator
 Comparator for 2D vectors. More...

Public Member Functions

std::vector< GraspHypothesisclassify (const std::vector< GraspHypothesis > &hands_list, const std::string &svm_filename, const Eigen::Matrix3Xd &cam_pos, bool is_plotting=false)
 Predict antipodal grasps using an SVM classifier.
 Learning ()
 Constructor.
 Learning (int num_threads)
 Constructor. Set the number of threads to be used for prediction.
void train (const std::vector< GraspHypothesis > &hands_list, const std::vector< int > &sizes, const std::string &file_name, const Eigen::Matrix3Xd &cam_pos, int max_positive=1000000000, bool is_plotting=false)
 Train an SVM classifier to predict antipodal grasps.
void train (const std::vector< GraspHypothesis > &hands_list, const std::string &file_name, const Eigen::Matrix3Xd &cam_pos, bool is_plotting=false)
 Train an SVM classifier to predict antipodal grasps.
void trainBalanced (const std::vector< GraspHypothesis > &hands_list, const std::vector< int > &sizes, const std::string &file_name, const Eigen::Matrix3Xd &cam_pos, int max_positive=1000000000, bool is_plotting=false)
 Train an SVM classifier to predict antipodal grasps. Uses the same number of positives and negatives for each training point cloud.

Private Member Functions

void convertData (const std::vector< Instance > &instances, const std::string &file_name, bool is_plotting=false, bool uses_linear_kernel=false)
 Convert a set of learning instances to training data readable by the SVM.
cv::Mat convertToImage (const Instance &ins)
 Convert a learning instance to a grasp image.
Instance createInstance (const GraspHypothesis &h, const Eigen::Matrix3Xd &cam_pos, int cam=-1)
 Create a learning instance from a grasp hypothesis.
Eigen::VectorXi floorVector (const Eigen::VectorXd &a)
 Round a vector's elements down to the closest, smaller integers.

Private Attributes

int num_horizontal_cells_
 the width of a grasp image
int num_threads_
 the number of threads used for prediction
int num_vertical_cells_
 the height of a grasp image

Detailed Description

Train and use an SVM to predict antipodal grasps.

Learning class

This class trains an SVM classifier to predict antipodal grasps. Once trained, it can be used to predict antipodal grasps. The classifier is trained with HOG features obtained from grasp images. A grasp image is a 2D image representation of a grasp hypothesis.

Definition at line 56 of file learning.h.


Constructor & Destructor Documentation

Learning::Learning ( ) [inline]

Constructor.

Definition at line 63 of file learning.h.

Learning::Learning ( int  num_threads) [inline]

Constructor. Set the number of threads to be used for prediction.

Definition at line 71 of file learning.h.


Member Function Documentation

std::vector< GraspHypothesis > Learning::classify ( const std::vector< GraspHypothesis > &  hands_list,
const std::string &  svm_filename,
const Eigen::Matrix3Xd &  cam_pos,
bool  is_plotting = false 
)

Predict antipodal grasps using an SVM classifier.

Parameters:
hands_listthe set of grasp hypotheses to be tested for being antipodal grasps
file_namethe location and name of the file in which the SVM is stored
cam_posthe camera poses
is_plottingwhether the training process is visualized

Definition at line 165 of file learning.cpp.

void Learning::convertData ( const std::vector< Instance > &  instances,
const std::string &  file_name,
bool  is_plotting = false,
bool  uses_linear_kernel = false 
) [private]

Convert a set of learning instances to training data readable by the SVM.

Parameters:
instancesthe training instances to be converted
file_namethe location and name of the file in which the SVM is stored
is_plottingwhether the conversion process is visualized
uses_linear_kernelwhether a linear or a quadratic kernel is used in the SVM

Definition at line 249 of file learning.cpp.

cv::Mat Learning::convertToImage ( const Instance ins) [private]

Convert a learning instance to a grasp image.

Parameters:
insthe learning instance to be converted
Returns:
the created image

Definition at line 320 of file learning.cpp.

Learning::Instance Learning::createInstance ( const GraspHypothesis h,
const Eigen::Matrix3Xd &  cam_pos,
int  cam = -1 
) [private]

Create a learning instance from a grasp hypothesis.

Parameters:
hthe grasp hypothesis from which the learning instance is created
cam_posthe camera poses
camindex of the camera which produced the points in the grasp hypothesis
Returns:
the created learning instance

Definition at line 375 of file learning.cpp.

Eigen::VectorXi Learning::floorVector ( const Eigen::VectorXd &  a) [private]

Round a vector's elements down to the closest, smaller integers.

Parameters:
athe vector whose elements are rounded down
Returns:
the vector containing the rounded elements

Definition at line 367 of file learning.cpp.

void Learning::train ( const std::vector< GraspHypothesis > &  hands_list,
const std::vector< int > &  sizes,
const std::string &  file_name,
const Eigen::Matrix3Xd &  cam_pos,
int  max_positive = 1000000000,
bool  is_plotting = false 
)

Train an SVM classifier to predict antipodal grasps.

Parameters:
hands_listthe set of grasp hypotheses to be used for training
sizesthe number of grasp hypotheses found for each training point cloud
file_namethe location and name of the file in which the SVM is stored
max_positivethe maximum number of positives examples to be used from each training point cloud
cam_posthe camera poses
is_plottingwhether the training process is visualized

Definition at line 76 of file learning.cpp.

void Learning::train ( const std::vector< GraspHypothesis > &  hands_list,
const std::string &  file_name,
const Eigen::Matrix3Xd &  cam_pos,
bool  is_plotting = false 
)

Train an SVM classifier to predict antipodal grasps.

Parameters:
hands_listthe set of grasp hypotheses to be used for training
sizesthe number of grasp hypotheses found for each training point cloud
file_namethe location and name of the file in which the SVM is stored
is_plottingwhether the training process is visualized

Definition at line 143 of file learning.cpp.

void Learning::trainBalanced ( const std::vector< GraspHypothesis > &  hands_list,
const std::vector< int > &  sizes,
const std::string &  file_name,
const Eigen::Matrix3Xd &  cam_pos,
int  max_positive = 1000000000,
bool  is_plotting = false 
)

Train an SVM classifier to predict antipodal grasps. Uses the same number of positives and negatives for each training point cloud.

Parameters:
hands_listthe set of grasp hypotheses to be used for training
sizesthe number of grasp hypotheses found for each training point cloud
file_namethe location and name of the file in which the SVM is stored
cam_posthe camera poses
max_positivethe maximum number of positives examples to be used from each training point cloud
is_plottingwhether the training process is visualized

Definition at line 3 of file learning.cpp.


Member Data Documentation

the width of a grasp image

Definition at line 198 of file learning.h.

int Learning::num_threads_ [private]

the number of threads used for prediction

Definition at line 200 of file learning.h.

the height of a grasp image

Definition at line 199 of file learning.h.


The documentation for this class was generated from the following files:


agile_grasp
Author(s): Andreas ten Pas
autogenerated on Sat Jun 8 2019 20:08:27