From 55df97afe1625c834fe931a52373b6f4f2db51ad Mon Sep 17 00:00:00 2001 From: Micaela Verucchi Date: Tue, 23 Nov 2021 13:01:07 +0100 Subject: [PATCH] Fix warnings, upgrade to C++14 Signed-off-by: Micaela Verucchi --- CMakeLists.txt | 4 ++-- include/tkDNN/SegmentationNN.h | 1 + src/CenterTrack.cpp | 10 +++++++++- src/CenternetDetection.cpp | 1 + src/CenternetDetection3D.cpp | 2 ++ src/MobilenetDetection.cpp | 4 ++-- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b366416..20ede6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,10 +3,10 @@ cmake_minimum_required(VERSION 3.15) project (tkDNN) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) if(UNIX) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -Wno-deprecated-declarations -Wno-unused-variable ") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fPIC -Wno-deprecated-declarations") endif() if(WIN32) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_FLAGS "/O2 /FS /EHsc") set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif(WIN32) diff --git a/include/tkDNN/SegmentationNN.h b/include/tkDNN/SegmentationNN.h index b691cbc..b73ffa2 100644 --- a/include/tkDNN/SegmentationNN.h +++ b/include/tkDNN/SegmentationNN.h @@ -182,6 +182,7 @@ class SegmentationNN { checkCuda(cudaMemcpyAsync(mean_d, mean.data(), mean.size() * sizeof(float), cudaMemcpyHostToDevice, netRT->stream)); checkCuda(cudaMemcpyAsync(stddev_d, stddev.data(), stddev.size() * sizeof(float), cudaMemcpyHostToDevice, netRT->stream)); + return true; } /** diff --git a/src/CenterTrack.cpp b/src/CenterTrack.cpp index dc15823..991ff69 100644 --- a/src/CenterTrack.cpp +++ b/src/CenterTrack.cpp @@ -17,6 +17,8 @@ bool CenterTrack::init(const std::string& tensor_path, const int n_classes, cons init_pre_inf(); init_postprocessing(); init_visualization(n_classes); + + return true; } bool CenterTrack::init_preprocessing(){ @@ -59,6 +61,8 @@ bool CenterTrack::init_preprocessing(){ checkCuda( cudaMalloc(&input_d, sizeof(dnnType)*netRT->input_dim.tot() * nBatches)); checkCuda( cudaMalloc(&input_pre_inf_d, sizeof(dnnType)*dim.tot())); checkCuda( cudaMalloc(&d_ptrs, dim.tot() * sizeof(float)) ); + + return true; } bool CenterTrack::init_pre_inf(){ @@ -202,6 +206,8 @@ bool CenterTrack::init_postprocessing(){ trRes.resize(nBatches); countTr.resize(nBatches, 0); trackId.resize(nBatches, 0); + + return true; } bool CenterTrack::init_visualization(const int n_classes){ @@ -274,6 +280,8 @@ bool CenterTrack::init_visualization(const int n_classes){ faceId.push_back({3,0,4,7}); faceId.push_back({2,3,7,6}); // ([[0,1,5,4], [1,2,6, 5], [2,3,7,6], [3,0,4,7]]); + + return true; } void CenterTrack::_get_additional_inputs(){ @@ -308,7 +316,7 @@ void CenterTrack::preprocess(cv::Mat &frame, const int bi){ } float c[] = {new_width / 2.0f, new_height /2.0f}; - float s[] = {dim.w, dim.h}; + float s[] = {float(dim.w), float(dim.h)}; // float s = new_width >= new_height ? new_width : new_height; // ----------- get_affine_transform // rot_rad = pi * 0 / 100 --> 0 diff --git a/src/CenternetDetection.cpp b/src/CenternetDetection.cpp index 46757f4..dce1455 100644 --- a/src/CenternetDetection.cpp +++ b/src/CenternetDetection.cpp @@ -119,6 +119,7 @@ bool CenternetDetection::init(const std::string& tensor_path, const int n_classe dst2.at(2,0)=dst2.at(1,0) + (-dst2.at(0,1)+dst2.at(1,1) ); dst2.at(2,1)=dst2.at(1,1) + (dst2.at(0,0)-dst2.at(1,0) ); + return true; } diff --git a/src/CenternetDetection3D.cpp b/src/CenternetDetection3D.cpp index 653624b..14f674d 100644 --- a/src/CenternetDetection3D.cpp +++ b/src/CenternetDetection3D.cpp @@ -167,6 +167,8 @@ bool CenternetDetection3D::init(const std::string& tensor_path, const int n_clas faceId.push_back({2,3,7,6}); faceId.push_back({3,0,4,7}); // ([[0,1,5,4], [1,2,6, 5], [2,3,7,6], [3,0,4,7]]); + + return true; } void CenternetDetection3D::preprocess(cv::Mat &frame, const int bi){ diff --git a/src/MobilenetDetection.cpp b/src/MobilenetDetection.cpp index 3c54e28..13b836f 100644 --- a/src/MobilenetDetection.cpp +++ b/src/MobilenetDetection.cpp @@ -198,7 +198,7 @@ bool MobilenetDetection::init(const std::string& tensor_path, const int n_classe "bottle" , "wine glass" , "cup" , "fork" , "knife" , "spoon" , "bowl" , "banana" , "apple" , "sandwich" , "orange" , "broccoli" , "carrot" , "hot dog" , "pizza" , "donut" , "cake" , "chair" , "sofa" , "pottedplant" , "bed" , "diningtable" , - "toilet" , "tvmonitor" , "laptop" , "mouse" , "remote" , "keyboard" , + "toilet" , "tvmonitor" , "laptop" , "mouse" , "remote" , "keyboard" , "cell phone" , "microwave" , "oven" , "toaster" , "sink" , "refrigerator" , "book" , "clock" , "vase" , "scissors" , "teddy bear" , "hair drier" , "toothbrush"}; classesNames = std::vector(classes_names_, std::end(classes_names_)); @@ -207,7 +207,7 @@ bool MobilenetDetection::init(const std::string& tensor_path, const int n_classe else{ FatalError("Number of classes not supported for mobilenet"); } - return 1; + return true; } void MobilenetDetection::preprocess(cv::Mat &frame, const int bi){