From 2f0592d540cdf67396a15f1514075dd615cfba88 Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Mon, 18 Mar 2019 15:22:38 +0300 Subject: [PATCH] Compile fixes --- CMakeLists.txt | 4 ++-- src/dark_cuda.c | 3 ++- src/yolo_v2_class.cpp | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6e6323a..05acdad3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -288,8 +288,8 @@ target_link_libraries(darknet PRIVATE Threads::Threads) target_link_libraries(darklib PRIVATE Threads::Threads) if(ENABLE_CUDA) - target_link_libraries(darknet PRIVATE curand cublas) - target_link_libraries(darklib PRIVATE curand cublas) + target_link_libraries(darknet PRIVATE curand cublas cuda) + target_link_libraries(darklib PRIVATE curand cublas cuda) set_target_properties(darklib PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON) endif() diff --git a/src/dark_cuda.c b/src/dark_cuda.c index 42aa6fc8..5b57ea1d 100644 --- a/src/dark_cuda.c +++ b/src/dark_cuda.c @@ -8,13 +8,14 @@ int gpu_index = 0; #ifdef GPU -#include "cuda.h" +#include "dark_cuda.h" #include "utils.h" #include "blas.h" #include "assert.h" #include #include #include +#include #pragma comment(lib, "cuda.lib") diff --git a/src/yolo_v2_class.cpp b/src/yolo_v2_class.cpp index 86c7acbd..3ebc8024 100644 --- a/src/yolo_v2_class.cpp +++ b/src/yolo_v2_class.cpp @@ -393,7 +393,7 @@ LIB_API bool Detector::send_json_http(std::vector cur_bbox_vec, std::vec char *tmp_buf = (char *)calloc(1024, sizeof(char)); if (!filename.empty()) { - sprintf(tmp_buf, "{\n \"frame_id\":%d, \n \"filename\":\"%s\", \n \"objects\": [ \n", frame_id, filename); + sprintf(tmp_buf, "{\n \"frame_id\":%d, \n \"filename\":\"%s\", \n \"objects\": [ \n", frame_id, filename.c_str()); } else { sprintf(tmp_buf, "{\n \"frame_id\":%d, \n \"objects\": [ \n", frame_id); @@ -405,7 +405,7 @@ LIB_API bool Detector::send_json_http(std::vector cur_bbox_vec, std::vec char *buf = (char *)calloc(2048, sizeof(char)); sprintf(buf, " {\"class_id\":%d, \"name\":\"%s\", \"absolute_coordinates\":{\"center_x\":%d, \"center_y\":%d, \"width\":%d, \"height\":%d}, \"confidence\":%f", - i.obj_id, obj_names[i.obj_id], i.x, i.y, i.w, i.h, i.prob); + i.obj_id, obj_names[i.obj_id].c_str(), i.x, i.y, i.w, i.h, i.prob); //sprintf(buf, " {\"class_id\":%d, \"name\":\"%s\", \"relative_coordinates\":{\"center_x\":%f, \"center_y\":%f, \"width\":%f, \"height\":%f}, \"confidence\":%f", // i.obj_id, obj_names[i.obj_id], i.x, i.y, i.w, i.h, i.prob); @@ -414,7 +414,7 @@ LIB_API bool Detector::send_json_http(std::vector cur_bbox_vec, std::vec if (!std::isnan(i.z_3d)) { sprintf(buf, "\n , \"coordinates_in_meters\":{\"x_3d\":%.2f, \"y_3d\":%.2f, \"z_3d\":%.2f}", - i.x_3d*100, i.y_3d, i.z_3d); + i.x_3d, i.y_3d, i.z_3d); send_str += buf; }