AlexeyAB
2017-08-11 489207111f1cdf0d7e3bcfc2410a92121c58f3cd
Some fixes
4 files modified
31 ■■■■■ changed files
build/darknet/darknet_no_gpu.vcxproj 2 ●●●●● patch | view | raw | blame | history
build/darknet/yolo_cpp_dll.vcxproj 2 ●●●●● patch | view | raw | blame | history
src/parser.c 10 ●●●●● patch | view | raw | blame | history
src/yolo_console_dll.cpp 17 ●●●● patch | view | raw | blame | history
build/darknet/darknet_no_gpu.vcxproj
@@ -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>
build/darknet/yolo_cpp_dll.vcxproj
@@ -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>
src/parser.c
@@ -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 @@
    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;
src/yolo_console_dll.cpp
@@ -81,31 +81,30 @@
        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();) {
                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()) {
                        result_vec = detector.tracking(result_vec); // comment it - if track_id is not required
                        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