From 70eb5214cc06e44221928d953a2e17f86f44e48d Mon Sep 17 00:00:00 2001 From: Davide Sapienza Date: Thu, 6 Feb 2020 18:08:06 +0100 Subject: [PATCH] Change CenterNet input dimension. This commit changes the image input dimension, it updates the CenterNet detection class. Signed-off-by: Davide Sapienza --- include/tkDNN/CenternetDetection.h | 6 +++--- src/CenternetDetection.cpp | 17 +++++++++++------ src/DeformConv2d.cpp | 9 ++++++--- tests/dla34_cnet/dla34_cnet.cpp | 2 +- tests/resnet101_cnet/resnet101_cnet.cpp | 2 +- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/include/tkDNN/CenternetDetection.h b/include/tkDNN/CenternetDetection.h index 46af73b..1868839 100644 --- a/include/tkDNN/CenternetDetection.h +++ b/include/tkDNN/CenternetDetection.h @@ -73,14 +73,14 @@ class CenternetDetection { //processing float toll = 0.000001; int K = 100; - int width = 56; // TODO + int width = 128;//56; // TODO public: dnnType *rt_out[4]; - float inp_height = 224;//512; - float inp_width = 224;//512; + float inp_height = 512;//224;//512; + float inp_width = 512;//224;//512; int classes = 80; int num = 0; diff --git a/src/CenternetDetection.cpp b/src/CenternetDetection.cpp index fbc9832..c6c4bc7 100644 --- a/src/CenternetDetection.cpp +++ b/src/CenternetDetection.cpp @@ -18,7 +18,7 @@ bool CenternetDetection::init(std::string tensor_path) { std::cout<<(tensor_path).c_str()<<"\n"; netRT = new tk::dnn::NetworkRT(NULL, (tensor_path).c_str() ); - dim = tk::dnn::dataDim_t(1, 3, 224, 224, 1); + dim = tk::dnn::dataDim_t(1, 3, 512, 512, 1); const char *coco_class_name_[] = { "person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic light", "fire hydrant", @@ -43,9 +43,12 @@ bool CenternetDetection::init(std::string tensor_path) { checkCuda(cudaMallocHost(&input, sizeof(dnnType)*netRT->input_dim.tot())); checkCuda(cudaMalloc(&input_d, sizeof(dnnType)*netRT->input_dim.tot())); - dim_hm = tk::dnn::dataDim_t(1, 80, 56, 56, 1); - dim_wh = tk::dnn::dataDim_t(1, 2, 56, 56, 1); - dim_reg = tk::dnn::dataDim_t(1, 2, 56, 56, 1); + // dim_hm = tk::dnn::dataDim_t(1, 80, 56, 56, 1); + // dim_wh = tk::dnn::dataDim_t(1, 2, 56, 56, 1); + // dim_reg = tk::dnn::dataDim_t(1, 2, 56, 56, 1); + dim_hm = tk::dnn::dataDim_t(1, 80, 128, 128, 1); + dim_wh = tk::dnn::dataDim_t(1, 2, 128, 128, 1); + dim_reg = tk::dnn::dataDim_t(1, 2, 128, 128, 1); checkCuda( cudaMalloc(&topk_scores, dim_hm.c * K *sizeof(float)) ); checkCuda( cudaMalloc(&topk_inds_, dim_hm.c * K *sizeof(int)) ); @@ -93,6 +96,8 @@ bool CenternetDetection::init(std::string tensor_path) { mean << 0.408, 0.447, 0.47; stddev << 0.289, 0.274, 0.278; + // mean << 0.485, 0.456, 0.406; + // stddev << 0.229, 0.224, 0.225; } void CenternetDetection::testdog() { @@ -104,8 +109,8 @@ void CenternetDetection::testdog() { imageORIG.convertTo(imageF, CV_32FC3, 1/255.0); sz = imageF.size(); std::cout<<"image: "<