25#include "modules/perception/camera_detection_multi_stage/detector/yolo/proto/model_param.pb.h"
35static const char NormalNMS[] =
"NormalNMS";
36static const char LinearSoftNMS[] =
"LinearSoftNMS";
37static const char GuassianSoftNMS[] =
"GuassianSoftNMS";
38static const char BoxVote[] =
"BoxVote";
39static const int kBoxBlockSize = 32;
40static const int kMaxObjSize = 1000;
74 std::string
type = BoxVote;
130 const bool normalized);
136 const std::pair<float, T> &pair2) {
137 return pair1.first > pair2.first;
148 const float threshold,
const int top_k,
149 std::vector<std::pair<float, int>> *score_index_vec);
160 const NormalizedBBox &bbox2,
161 NormalizedBBox *intersect_bbox);
170 const NormalizedBBox &bbox2);
179 std::vector<int> *indices);
196 const std::vector<int> &origin_indices,
const int bbox_step,
197 const float confidence_threshold,
const int top_k,
198 const float nms_threshold, std::vector<int> *indices,
200 const cudaStream_t &_stream);
213 const float overlap_threshold,
214 const int *idx,
const int num_idx,
215 bool *overlapped_data,
216 const cudaStream_t &_stream);
234 const YoloBlobs &yolo_blobs,
const cudaStream_t &stream,
235 const std::vector<base::ObjectSubType> &types,
const NMSParam &nms,
256 const std::vector<base::ObjectSubType> &types,
258 float light_vis_conf_threshold,
259 float light_swt_conf_threshold,
261 std::vector<base::ObjectPtr> *objects);
275 std::vector<float> *scores,
const float score_threshold,
276 const float nms_threshold,
const int top_k,
277 std::vector<int> *indices,
bool is_linear,
291 std::vector<float> *scores,
292 const float conf_threshold,
const float nms_threshold,
293 const float sigma, std::vector<int> *indices);
306 const std::vector<float> &scores,
307 const float score_threshold,
const float nms_threshold,
308 const float eta,
const int top_k,
309 std::vector<int> *indices);
319 std::vector<base::ObjectPtr> *objects);
328 std::vector<base::ObjectPtr> *objects);
A wrapper around SyncedMemory holders serving as the basic computational unit for images,...
std::shared_ptr< Object > ObjectPtr
void get_max_score_index(const std::vector< float > &scores, const float threshold, const int top_k, std::vector< std::pair< float, int > > *score_index_vec)
Get the max score index object
void apply_softnms_fast(const std::vector< NormalizedBBox > &bboxes, std::vector< float > *scores, const float score_threshold, const float nms_threshold, const int top_k, std::vector< int > *indices, bool is_linear, const float sigma)
softnms for objects
void recover_bbox(int roi_w, int roi_h, int offset_y, std::vector< base::ObjectPtr > *objects)
recover detect bbox result to raw image
void apply_boxvoting_fast(std::vector< NormalizedBBox > *bboxes, std::vector< float > *scores, const float conf_threshold, const float nms_threshold, const float sigma, std::vector< int > *indices)
filter target detection results based on given thresholds and parameters.
__host__ __device__ float sigmoid_gpu(float x)
void apply_nms(const bool *overlapped, const int num, std::vector< int > *indices)
Get all boxes with score larger than threshold
float get_bbox_size(const NormalizedBBox &bbox)
__host__ __device__ float jaccard_overlap_gpu(const float *bbox1, const float *bbox2)
int get_objects_gpu(const YoloBlobs &yolo_blobs, const cudaStream_t &stream, const std::vector< base::ObjectSubType > &types, const NMSParam &nms, const yolo::ModelParam &model_param, float light_vis_conf_threshold, float light_swt_conf_threshold, base::Blob< bool > *overlapped, base::Blob< int > *idx_sm, const std::map< base::ObjectSubType, std::vector< int > > &indices, const std::map< base::ObjectSubType, std::vector< float > > &conf_scores)
Get the objects gpu object
void fill_base(base::ObjectPtr obj, const float *bbox)
add bbox value to object
void fill_ratios(bool with_ratios, base::ObjectPtr obj, const float *bbox)
add ratio value to object
constexpr float minExpPower
void apply_nms_gpu(const float *bbox_data, const float *conf_data, const std::vector< int > &origin_indices, const int bbox_step, const float confidence_threshold, const int top_k, const float nms_threshold, std::vector< int > *indices, base::Blob< bool > *overlapped, base::Blob< int > *idx_sm, const cudaStream_t &_stream)
Get all boxes with score larger than threshold
void fill_frbox(bool with_frbox, base::ObjectPtr obj, const float *bbox)
add car front and backward bbox value to object
bool sort_score_pair_descend(const std::pair< float, T > &pair1, const std::pair< float, T > &pair2)
int get_area_id(float visible_ratios[4])
calculate the area id based on the visible ratios
void get_intersect_bbox(const NormalizedBBox &bbox1, const NormalizedBBox &bbox2, NormalizedBBox *intersect_bbox)
Get the intersect bbox object
__host__ __device__ float bbox_size_gpu(const float *bbox, const bool normalized)
void fill_area_id(bool with_flag, base::ObjectPtr obj, const float *data)
add area id value to object
constexpr float maxExpPower
constexpr int anchorSizeFactor
float get_jaccard_overlap(const NormalizedBBox &bbox1, const NormalizedBBox &bbox2)
Get the jaccard overlap object
void compute_overlapped_by_idx_gpu(const int nthreads, const float *bbox_data, const float overlap_threshold, const int *idx, const int num_idx, bool *overlapped_data, const cudaStream_t &_stream)
Get all boxes with score larger than threshold
void get_objects_cpu(const YoloBlobs &yolo_blobs, const cudaStream_t &stream, const std::vector< base::ObjectSubType > &types, const NMSParam &nms, const yolo::ModelParam &model_param, float light_vis_conf_threshold, float light_swt_conf_threshold, base::Blob< bool > *overlapped, base::Blob< int > *idx_sm, std::vector< base::ObjectPtr > *objects)
Get the objects cpu object
const float * get_gpu_data(bool flag, const base::Blob< float > &blob)
Get the gpu data object
void fill_bbox3d(bool with_box3d, base::ObjectPtr obj, const float *bbox)
add alpha h w l to object
void filter_bbox(const MinDims &min_dims, std::vector< base::ObjectPtr > *objects)
filter out the objects in the object array based on the given minimum dimension conditions and retain...
void fill_lights(bool with_lights, base::ObjectPtr obj, const float *bbox)
add car lights value to object
void apply_nms_fast(const std::vector< NormalizedBBox > &bboxes, const std::vector< float > &scores, const float score_threshold, const float nms_threshold, const float eta, const int top_k, std::vector< int > *indices)
nms for objects
float inter_cls_conf_thresh
float inter_cls_nms_thresh
bool operator()(NormalizedBBox i, NormalizedBBox j)
std::shared_ptr< base::Blob< float > > area_id_blob
std::shared_ptr< base::Blob< float > > lof_blob
std::shared_ptr< base::Blob< float > > det3_dim_blob
std::shared_ptr< base::Blob< float > > det2_obj_blob
std::shared_ptr< base::Blob< float > > det3_ori_conf_blob
std::shared_ptr< base::Blob< float > > expand_blob
std::shared_ptr< base::Blob< float > > visible_ratio_blob
std::shared_ptr< base::Blob< float > > det3_cls_blob
std::shared_ptr< base::Blob< float > > ltvis_blob
std::shared_ptr< base::Blob< float > > res_cls_blob
std::shared_ptr< base::Blob< float > > res_box_blob
std::shared_ptr< base::Blob< float > > det3_loc_blob
std::shared_ptr< base::Blob< float > > feat_blob
std::shared_ptr< base::Blob< float > > det1_loc_blob
std::shared_ptr< base::Blob< float > > det1_cls_blob
std::shared_ptr< base::Blob< float > > det1_dim_blob
std::shared_ptr< base::Blob< float > > lor_blob
std::shared_ptr< base::Blob< float > > anchor_blob
std::shared_ptr< base::Blob< float > > det3_obj_blob
std::shared_ptr< base::Blob< float > > brswt_blob
std::shared_ptr< base::Blob< float > > det1_ori_conf_blob
std::shared_ptr< base::Blob< float > > ltswt_blob
std::shared_ptr< base::Blob< float > > det2_ori_blob
std::shared_ptr< base::Blob< float > > brvis_blob
std::shared_ptr< base::Blob< float > > det3_ori_blob
std::shared_ptr< base::Blob< float > > det1_ori_blob
std::shared_ptr< base::Blob< float > > det1_obj_blob
std::shared_ptr< base::Blob< float > > rtvis_blob
std::shared_ptr< base::Blob< float > > det2_ori_conf_blob
std::shared_ptr< base::Blob< float > > cut_off_ratio_blob
std::shared_ptr< base::Blob< float > > det2_cls_blob
std::shared_ptr< base::Blob< float > > det2_dim_blob
std::shared_ptr< base::Blob< float > > det2_loc_blob
std::shared_ptr< base::Blob< float > > rtswt_blob