diff --git a/build/darknet/darknet_no_gpu.vcxproj b/build/darknet/darknet_no_gpu.vcxproj index db59fa89..6a060790 100644 --- a/build/darknet/darknet_no_gpu.vcxproj +++ b/build/darknet/darknet_no_gpu.vcxproj @@ -67,9 +67,11 @@ $(SolutionDir)$(Platform)\ + $(Platform)\nogpu_$(Configuration)\ $(SolutionDir)$(Platform)\ + $(Platform)\nogpu_$(Configuration)\ diff --git a/build/darknet/yolo_cpp_dll.vcxproj b/build/darknet/yolo_cpp_dll.vcxproj index 86942aee..483e2589 100644 --- a/build/darknet/yolo_cpp_dll.vcxproj +++ b/build/darknet/yolo_cpp_dll.vcxproj @@ -69,9 +69,11 @@ $(SolutionDir)$(Platform)\ + $(Platform)\DLL_$(Configuration)\ $(SolutionDir)$(Platform)\ + $(Platform)\DLL_$(Configuration)\ diff --git a/src/parser.c b/src/parser.c index 3f39a138..922227a7 100644 --- a/src/parser.c +++ b/src/parser.c @@ -29,6 +29,7 @@ #include "shortcut_layer.h" #include "softmax_layer.h" #include "utils.h" +#include typedef struct{ char *type; @@ -1023,7 +1024,14 @@ void load_weights_upto(network *net, char *filename, int cutoff) fread(&major, sizeof(int), 1, fp); fread(&minor, sizeof(int), 1, fp); fread(&revision, sizeof(int), 1, fp); - fread(net->seen, sizeof(int), 1, fp); + if ((major * 10 + minor) >= 2) { + fread(net->seen, sizeof(uint64_t), 1, fp); + } + else { + int iseen = 0; + fread(&iseen, sizeof(int), 1, fp); + *net->seen = iseen; + } int transpose = (major > 1000) || (minor > 1000); int i; diff --git a/src/yolo_console_dll.cpp b/src/yolo_console_dll.cpp index e1f2c7e8..3560a28d 100644 --- a/src/yolo_console_dll.cpp +++ b/src/yolo_console_dll.cpp @@ -81,31 +81,30 @@ int main(int argc, char *argv[]) try { #ifdef OPENCV std::string const file_ext = filename.substr(filename.find_last_of(".") + 1); - std::string const protocol = filename.substr(0, 4); + std::string const protocol = filename.substr(0, 7); if (file_ext == "avi" || file_ext == "mp4" || file_ext == "mjpg" || file_ext == "mov" || // video file - protocol == "rtsp" || protocol == "http") // video network stream + protocol == "rtsp://" || protocol == "http://" || protocol == "https:/") // video network stream { cv::Mat frame, prev_frame, det_frame; std::vector result_vec, thread_result_vec; detector.nms = 0.02; // comment it - if track_id is not required std::thread td([]() {}); std::atomic ready_flag; - ready_flag = false; - cv::VideoCapture cap(filename); - for (; cap >> frame, cap.isOpened();) { - td.join(); - result_vec = thread_result_vec; - det_frame = frame; - td = std::thread([&]() { thread_result_vec = detector.detect(det_frame, 0.24, true); ready_flag = true; }); - - if (!prev_frame.empty()) { + ready_flag = true; + for (cv::VideoCapture cap(filename); cap >> frame, cap.isOpened();) { + if (ready_flag || (protocol != "rtsp://" && protocol != "http://" && protocol != "https:/")) { + td.join(); + ready_flag = false; + result_vec = thread_result_vec; result_vec = detector.tracking(result_vec); // comment it - if track_id is not required + det_frame = frame; + td = std::thread([&]() { thread_result_vec = detector.detect(det_frame, 0.24, true); ready_flag = true; }); + } + if (!prev_frame.empty()) { draw_boxes(prev_frame, result_vec, obj_names, 3); show_result(result_vec, obj_names); } prev_frame = frame; - //if (protocol == "rtsp" || protocol == "http") do { cap.grab(); } while (!ready_flag); // use if cam-fps 2x or more than dnn-fps - ready_flag = false; } } else if (file_ext == "txt") { // list of image files