Add OPENCV_CUDA define, to allow having preprocess both in CPU and GPU (Mobilenet and Centernet)
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
This commit is contained in:
@@ -35,9 +35,7 @@ class CenternetDetection {
|
||||
int ndets = 0;
|
||||
// tk::dnn::Yolo::detection *dets = nullptr;
|
||||
|
||||
cv::Mat imageF;
|
||||
cv::cuda::GpuMat imageF1_d, imageF2_d;
|
||||
cv::cuda::GpuMat bgr[3];
|
||||
cv::Mat imageOrig;
|
||||
// std::vector< cv::cuda::GpuMat > bgr;
|
||||
|
||||
// variable to test cnet on dog pictures
|
||||
@@ -71,8 +69,16 @@ class CenternetDetection {
|
||||
|
||||
float *target_coords;
|
||||
|
||||
float *mean_d;
|
||||
float *stddev_d;
|
||||
|
||||
|
||||
#ifdef OPENCV_CUDA
|
||||
float *mean_d;
|
||||
float *stddev_d;
|
||||
#else
|
||||
cv::Vec<float, 3> mean;
|
||||
cv::Vec<float, 3> stddev;
|
||||
dnnType *input;
|
||||
#endif
|
||||
|
||||
float *d_ptrs;
|
||||
|
||||
@@ -88,6 +94,8 @@ class CenternetDetection {
|
||||
// pointer used in the kernels
|
||||
float *src_out;
|
||||
int *ids_out;
|
||||
|
||||
void preprocess();
|
||||
public:
|
||||
dnnType *rt_out[4];
|
||||
|
||||
@@ -97,7 +105,7 @@ class CenternetDetection {
|
||||
int classes = 80;
|
||||
int num = 0;
|
||||
int n_masks = 0;
|
||||
float thresh = 0.0;
|
||||
float thresh = 0.3;
|
||||
cv::Scalar colors[256];
|
||||
|
||||
// this is filled with results
|
||||
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
void generate_ssd_priors(const SSDSpec *specs, const int n_specs, bool clamp = true);
|
||||
void convert_locatios_to_boxes_and_center();
|
||||
float iou(const tk::dnn::box &a, const tk::dnn::box &b);
|
||||
void preprocess(const bool gpu = true);
|
||||
void preprocess();
|
||||
std::vector<tk::dnn::box> postprocess(const int width, const int height);
|
||||
float get_color2(int c, int x, int max);
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#define dnnType float
|
||||
|
||||
#define OPENCV_CUDA
|
||||
|
||||
// Colored output
|
||||
#define COL_END "\033[0m"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user