#ifndef CNN_SEGMENTATION_H #define CNN_SEGMENTATION_H #include //#include #include "caffe/caffe.hpp" // #include #include #include #include //#include //#include //#include //#include //#include #include "cluster2d.h" #include "feature_generator.h" // #include "pcl_types.h" // #include "modules/perception/obstacle/lidar/segmentation/cnnseg/cnn_segmentation.h" #define __APP_NAME__ "lidar_cnn_seg_detect" struct CellStat { CellStat() : point_num(0), valid_point_num(0) { } int point_num; int valid_point_num; }; class CNNSegmentation { public: CNNSegmentation(); void run(); void test_run(); private: double range_, score_threshold_; int width_; int height_; bool use_constant_feature_; std::string topic_src_; // std_msgs::Header message_header_; int gpu_device_id_; bool use_gpu_; std::shared_ptr> caffe_net_; // center offset prediction boost::shared_ptr> instance_pt_blob_; // objectness prediction boost::shared_ptr> category_pt_blob_; // fg probability prediction boost::shared_ptr> confidence_pt_blob_; // object height prediction boost::shared_ptr> height_pt_blob_; // raw features to be input into network boost::shared_ptr> feature_blob_; // class prediction boost::shared_ptr> class_pt_blob_; // clustering model for post-processing std::shared_ptr cluster2d_; // bird-view raw feature generator std::shared_ptr feature_generator_; public: bool init( std::string proto_file,std::string weight_file,double rangemax,double score, int width,int height,bool use_const,bool usegpu,int gpudevid); bool segment(const pcl::PointCloud::Ptr &pc_ptr, const pcl::PointIndices &valid_idx, std::vector & objvec); // bool segment(const pcl::PointCloud::Ptr &pc_ptr, // const pcl::PointIndices &valid_idx, // rockauto_msgs::DetectedObjectArray &objects); // bool segment(const pcl::PointCloud::Ptr &pc_ptr, // const pcl::PointIndices &valid_idx); // void pointsCallback(const sensor_msgs::PointCloud2 &msg); // void pubColoredPoints(const rockauto_msgs::DetectedObjectArray &objects); }; #endif //CNN_SEGMENTATION_H