pull/5342/head
AlexeyAB 8 years ago
parent e4323274f2
commit 489207111f
  1. 2
      build/darknet/darknet_no_gpu.vcxproj
  2. 2
      build/darknet/yolo_cpp_dll.vcxproj
  3. 10
      src/parser.c
  4. 25
      src/yolo_console_dll.cpp

@ -67,9 +67,11 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Platform)\nogpu_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Platform)\nogpu_$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

@ -69,9 +69,11 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Platform)\DLL_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Platform)\DLL_$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

@ -29,6 +29,7 @@
#include "shortcut_layer.h"
#include "softmax_layer.h"
#include "utils.h"
#include <stdint.h>
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;

@ -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<bbox_t> result_vec, thread_result_vec;
detector.nms = 0.02; // comment it - if track_id is not required
std::thread td([]() {});
std::atomic<int> 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

Loading…
Cancel
Save