fix register plugin and cmp

This commit is contained in:
wang-xinyu 2020-08-28 19:30:17 +08:00
parent 52c48971e5
commit 4d2fa7149a
15 changed files with 15 additions and 23 deletions

View File

@ -28,6 +28,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Ofast -Wfatal-errors -
#cuda_add_library(leaky ${PROJECT_SOURCE_DIR}/leaky.cu)
cuda_add_library(yololayer SHARED ${PROJECT_SOURCE_DIR}/yololayer.cu)
target_link_libraries(yololayer nvinfer cudart)
find_package(OpenCV)
include_directories(OpenCV_INCLUDE_DIRS)

View File

@ -151,9 +151,7 @@ namespace nvinfer1
static PluginFieldCollection mFC;
static std::vector<PluginField> mPluginAttributes;
};
REGISTER_TENSORRT_PLUGIN(YoloPluginCreator);
};
#endif

View File

@ -37,7 +37,6 @@ static const int OUTPUT_SIZE = 1000 * 7 + 1; // we assume the yololayer outputs
const char* INPUT_BLOB_NAME = "data";
const char* OUTPUT_BLOB_NAME = "prob";
static Logger gLogger;
REGISTER_TENSORRT_PLUGIN(YoloPluginCreator);
cv::Mat preprocess_img(cv::Mat& img) {
int w, h, x, y;
@ -102,7 +101,7 @@ float iou(float lbox[4], float rbox[4]) {
return interBoxS/(lbox[2]*lbox[3] + rbox[2]*rbox[3] -interBoxS);
}
bool cmp(Yolo::Detection& a, Yolo::Detection& b) {
bool cmp(const Yolo::Detection& a, const Yolo::Detection& b) {
return a.det_confidence > b.det_confidence;
}

View File

@ -28,6 +28,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Ofast -Wfatal-errors -
#cuda_add_library(leaky ${PROJECT_SOURCE_DIR}/leaky.cu)
cuda_add_library(yololayer SHARED ${PROJECT_SOURCE_DIR}/yololayer.cu)
target_link_libraries(yololayer nvinfer cudart)
find_package(OpenCV)
include_directories(OpenCV_INCLUDE_DIRS)

View File

@ -142,9 +142,7 @@ namespace nvinfer1
static PluginFieldCollection mFC;
static std::vector<PluginField> mPluginAttributes;
};
REGISTER_TENSORRT_PLUGIN(YoloPluginCreator);
};
#endif

View File

@ -36,7 +36,6 @@ static const int OUTPUT_SIZE = 1000 * 7 + 1; // we assume the yololayer outputs
const char* INPUT_BLOB_NAME = "data";
const char* OUTPUT_BLOB_NAME = "prob";
static Logger gLogger;
REGISTER_TENSORRT_PLUGIN(YoloPluginCreator);
cv::Mat preprocess_img(cv::Mat& img) {
int w, h, x, y;
@ -101,7 +100,7 @@ float iou(float lbox[4], float rbox[4]) {
return interBoxS/(lbox[2]*lbox[3] + rbox[2]*rbox[3] -interBoxS);
}
bool cmp(Yolo::Detection& a, Yolo::Detection& b) {
bool cmp(const Yolo::Detection& a, const Yolo::Detection& b) {
return a.det_confidence > b.det_confidence;
}

View File

@ -28,6 +28,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Ofast -Wfatal-errors -
#cuda_add_library(leaky ${PROJECT_SOURCE_DIR}/leaky.cu)
cuda_add_library(yololayer SHARED ${PROJECT_SOURCE_DIR}/yololayer.cu)
target_link_libraries(yololayer nvinfer cudart)
find_package(OpenCV)
include_directories(OpenCV_INCLUDE_DIRS)

View File

@ -151,9 +151,7 @@ namespace nvinfer1
static PluginFieldCollection mFC;
static std::vector<PluginField> mPluginAttributes;
};
REGISTER_TENSORRT_PLUGIN(YoloPluginCreator);
};
#endif

View File

@ -37,7 +37,6 @@ static const int OUTPUT_SIZE = 1000 * 7 + 1; // we assume the yololayer outputs
const char* INPUT_BLOB_NAME = "data";
const char* OUTPUT_BLOB_NAME = "prob";
static Logger gLogger;
REGISTER_TENSORRT_PLUGIN(YoloPluginCreator);
cv::Mat preprocess_img(cv::Mat& img) {
int w, h, x, y;
@ -102,7 +101,7 @@ float iou(float lbox[4], float rbox[4]) {
return interBoxS/(lbox[2]*lbox[3] + rbox[2]*rbox[3] -interBoxS);
}
bool cmp(Yolo::Detection& a, Yolo::Detection& b) {
bool cmp(const Yolo::Detection& a, const Yolo::Detection& b) {
return a.det_confidence > b.det_confidence;
}

View File

@ -27,6 +27,7 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Ofast -Wfatal-errors -D_MWAITXINTRIN_H_INCLUDED")
cuda_add_library(myplugins SHARED ${PROJECT_SOURCE_DIR}/yololayer.cu ${PROJECT_SOURCE_DIR}/mish.cu)
target_link_libraries(myplugins nvinfer cudart)
find_package(OpenCV)
include_directories(OpenCV_INCLUDE_DIRS)

View File

@ -102,5 +102,6 @@ namespace nvinfer1
static PluginFieldCollection mFC;
static std::vector<PluginField> mPluginAttributes;
};
REGISTER_TENSORRT_PLUGIN(MishPluginCreator);
};
#endif

View File

@ -152,9 +152,7 @@ namespace nvinfer1
static PluginFieldCollection mFC;
static std::vector<PluginField> mPluginAttributes;
};
REGISTER_TENSORRT_PLUGIN(YoloPluginCreator);
};
#endif

View File

@ -40,8 +40,6 @@ static const int OUTPUT_SIZE = Yolo::MAX_OUTPUT_BBOX_COUNT * DETECTION_SIZE + 1;
const char* INPUT_BLOB_NAME = "data";
const char* OUTPUT_BLOB_NAME = "prob";
static Logger gLogger;
REGISTER_TENSORRT_PLUGIN(MishPluginCreator);
REGISTER_TENSORRT_PLUGIN(YoloPluginCreator);
cv::Mat preprocess_img(cv::Mat& img) {
int w, h, x, y;
@ -106,7 +104,7 @@ float iou(float lbox[4], float rbox[4]) {
return interBoxS/(lbox[2]*lbox[3] + rbox[2]*rbox[3] -interBoxS);
}
bool cmp(Yolo::Detection& a, Yolo::Detection& b) {
bool cmp(const Yolo::Detection& a, const Yolo::Detection& b) {
return a.det_confidence > b.det_confidence;
}

View File

@ -5,7 +5,7 @@ The Pytorch implementation is [ultralytics/yolov5](https://github.com/ultralytic
Currently, we support yolov5 v1.0(yolov5s only), v2.0 and v3.0.
- For yolov5 v3.0, please visit [yolov5 release v3.0](https://github.com/ultralytics/yolov5/releases/tag/v3.0), and use the latest commit of this repo.
- For yolov5 v2.0, please visit [yolov5 release v2.0](https://github.com/ultralytics/yolov5/releases/tag/v2.0), and checkout commit ['7cd092d'](https://github.com/wang-xinyu/tensorrtx/commit/7cd092d38289123442157cf7defab78e816f4440) of this repo or use the latest commit.
- For yolov5 v2.0, please visit [yolov5 release v2.0](https://github.com/ultralytics/yolov5/releases/tag/v2.0), and checkout commit ['7cd092d'](https://github.com/wang-xinyu/tensorrtx/commit/7cd092d38289123442157cf7defab78e816f4440) of this repo.
- For yolov5 v1.0, please visit [yolov5 release v1.0](https://github.com/ultralytics/yolov5/releases/tag/v1.0), and checkout commit ['0504551'](https://github.com/wang-xinyu/tensorrtx/commit/0504551c0b7d0bac5f998eda349810ba410715de) of this repo.
## Config

View File

@ -87,7 +87,7 @@ float iou(float lbox[4], float rbox[4]) {
return interBoxS/(lbox[2]*lbox[3] + rbox[2]*rbox[3] -interBoxS);
}
bool cmp(Yolo::Detection& a, Yolo::Detection& b) {
bool cmp(const Yolo::Detection& a, const Yolo::Detection& b) {
return a.conf > b.conf;
}