10 #include "pcl/recognition/face_detection/face_detector_data_provider.h"
11 #include "pcl/recognition/face_detection/rf_face_utils.h"
12 #include "pcl/ml/dt/decision_forest.h"
20 int max_patch_size_ {40};
23 std::string forest_filename_ {
"forest.txt"};
24 int nfeatures_ {10000};
25 float thres_face_ {1.f};
26 int num_images_ {1000};
27 float trans_max_variance_ {1600.f};
28 std::size_t min_votes_size_;
29 int used_for_pose_ {std::numeric_limits<int>::max ()};
30 bool use_normals_ {
false};
31 std::string directory_;
32 float HEAD_ST_DIAMETER_ {0.2364f};
33 float larger_radius_ratio_ {1.5f};
34 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > head_center_votes_{};
35 std::vector<std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > > head_center_votes_clustered_{};
36 std::vector<std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > > head_center_original_votes_clustered_{};
37 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > angle_votes_{};
38 std::vector<float> uncertainties_{};
39 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > head_clusters_centers_{};
40 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > head_clusters_rotation_{};
48 std::string model_path_ {
"face_mesh.ply"};
49 bool pose_refinement_ {
false};
50 int icp_iterations_{};
66 forest_filename_ = ff;
110 pose_refinement_ = do_it;
111 icp_iterations_ = iters;
121 trans_max_variance_ = max;
131 min_votes_size_ = mv;
153 heat_map = face_heat_map_;
159 votes_cloud->
points.resize (head_center_votes_.size ());
160 votes_cloud->
width = head_center_votes_.size ();
163 for (std::size_t i = 0; i < head_center_votes_.size (); i++)
165 (*votes_cloud)[i].getVector3fMap () = head_center_votes_[i];
171 votes_cloud->
points.resize (head_center_votes_.size ());
172 votes_cloud->
width = head_center_votes_.size ();
176 for (std::size_t i = 0; i < head_center_votes_clustered_.size (); i++)
178 for (std::size_t j = 0; j < head_center_votes_clustered_[i].size (); j++, p++)
180 (*votes_cloud)[p].getVector3fMap () = head_center_votes_clustered_[i][j];
181 (*votes_cloud)[p].intensity = 0.1f *
static_cast<float> (i);
185 votes_cloud->
points.resize (p);
190 votes_cloud->
points.resize (head_center_votes_.size ());
191 votes_cloud->
width = head_center_votes_.size ();
195 for (std::size_t i = 0; i < head_center_original_votes_clustered_.size (); i++)
197 for (std::size_t j = 0; j < head_center_original_votes_clustered_[i].size (); j++, p++)
199 (*votes_cloud)[p].getVector3fMap () = head_center_original_votes_clustered_[i][j];
200 (*votes_cloud)[p].intensity = 0.1f *
static_cast<float> (i);
204 votes_cloud->
points.resize (p);
210 for (std::size_t i = 0; i < head_clusters_centers_.size (); i++)
212 Eigen::VectorXf head (6);
213 head[0] = head_clusters_centers_[i][0];
214 head[1] = head_clusters_centers_[i][1];
215 head[2] = head_clusters_centers_[i][2];
216 head[3] = head_clusters_rotation_[i][0];
217 head[4] = head_clusters_rotation_[i][1];
218 head[5] = head_clusters_rotation_[i][2];
219 faces.push_back (head);
232 face_heat_map_ = heat_map;
Class representing a decision forest.
std::uint32_t width
The point cloud width (if organized as an image-structure).
std::uint32_t height
The point cloud height (if organized as an image-structure).
shared_ptr< PointCloud< PointT > > Ptr
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
RFFaceDetectorTrainer()=default
void faceVotesClustering()
void setUseNormals(bool use)
void getVotes(pcl::PointCloud< pcl::PointXYZI >::Ptr &votes_cloud)
void setFaceMinVotes(int mv)
void getDetectedFaces(std::vector< Eigen::VectorXf > &faces)
void getFaceHeatMap(pcl::PointCloud< pcl::PointXYZI >::Ptr &heat_map)
void setDirectory(std::string &dir)
void setInputCloud(pcl::PointCloud< pcl::PointXYZ >::Ptr &cloud)
void trainWithDataProvider()
void setForestFilename(std::string &ff)
void setNumTrees(int num)
void setForest(pcl::DecisionForest< NodeType > &forest)
void setNumFeatures(int num)
void setNumVotesUsedForPose(int n)
void setNumTrainingImages(int num)
void setLeavesFaceMaxVariance(float max)
void setPoseRefinement(bool do_it, int iters=5)
void getVotes(pcl::PointCloud< pcl::PointXYZ >::Ptr &votes_cloud)
virtual ~RFFaceDetectorTrainer()=default
void setLeavesFaceThreshold(float p)
void setFaceHeatMapCloud(pcl::PointCloud< pcl::PointXYZI >::Ptr &heat_map)
void setModelPath(std::string &model)
void getVotes2(pcl::PointCloud< pcl::PointXYZI >::Ptr &votes_cloud)