diff --git a/build/darknet/darknet.sln b/build/darknet/darknet.sln index 3d7efef2..c49e10ef 100644 --- a/build/darknet/darknet.sln +++ b/build/darknet/darknet.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2018 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "darknet", "darknet.vcxproj", "{4CF5694F-12A5-4012-8D94-9A0915E9FEB5}" EndProject @@ -13,8 +13,8 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4CF5694F-12A5-4012-8D94-9A0915E9FEB5}.Debug|Win32.ActiveCfg = Debug|x64 - {4CF5694F-12A5-4012-8D94-9A0915E9FEB5}.Debug|Win32.Build.0 = Debug|x64 + {4CF5694F-12A5-4012-8D94-9A0915E9FEB5}.Debug|Win32.ActiveCfg = Debug|Win32 + {4CF5694F-12A5-4012-8D94-9A0915E9FEB5}.Debug|Win32.Build.0 = Debug|Win32 {4CF5694F-12A5-4012-8D94-9A0915E9FEB5}.Debug|x64.ActiveCfg = Debug|x64 {4CF5694F-12A5-4012-8D94-9A0915E9FEB5}.Debug|x64.Build.0 = Debug|x64 {4CF5694F-12A5-4012-8D94-9A0915E9FEB5}.Release|Win32.ActiveCfg = Release|Win32 @@ -25,7 +25,4 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {C904B7F0-81ED-4CBE-82EC-94566A77D9AF} - EndGlobalSection EndGlobal diff --git a/build/darknet/darknet.vcxproj b/build/darknet/darknet.vcxproj index 92861642..8fbf93c3 100644 --- a/build/darknet/darknet.vcxproj +++ b/build/darknet/darknet.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,38 +21,38 @@ {4CF5694F-12A5-4012-8D94-9A0915E9FEB5} darknet - 10.0.17134.0 + 8.1 Application true - v141 + v140 MultiByte Application true - v141 + v140 MultiByte Application false - v141 + v140 true MultiByte Application false - v141 + v140 true MultiByte - + @@ -88,16 +88,15 @@ Level3 Disabled true - C:\opencv\opencv340\build\include;..\..\3rdparty\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir);$(cudnn)\include - OPENCV;CUDNN;_CRTDBG_MAP_ALLOC;_MBCS;_TIMESPEC_DEFINED;_CRT_SECURE_NO_WARNINGS;_CRT_RAND_S;GPU;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - - + C:\opencv_3.0\opencv\build\include;..\..\3rdparty\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir);$(cudnn)\include + CUDNN;_CRTDBG_MAP_ALLOC;_MBCS;_TIMESPEC_DEFINED;_CRT_SECURE_NO_WARNINGS;_CRT_RAND_S;GPU;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + OPENCV; true stdlib.h;crtdbg.h;%(ForcedIncludeFiles) true - C:\opencv\opencv340\build\x64\vc15\lib;$(CUDA_PATH)lib\$(PlatformName);$(cudnn)\lib\x64;%(AdditionalLibraryDirectories) + C:\opencv_3.0\opencv\build\x64\vc14\lib;C:\opencv_2.4.13\opencv\build\x64\vc12\lib;C:\opencv_2.4.13\opencv\build\x64\vc14\lib;$(CUDA_PATH)lib\$(PlatformName);$(cudnn)\lib\x64;%(AdditionalLibraryDirectories) $(OutDir)\$(TargetName)$(TargetExt) ..\..\3rdparty\lib\x64\pthreadVC2.lib;cublas.lib;curand.lib;cudart.lib;%(AdditionalDependencies) true @@ -133,7 +132,7 @@ true true true - C:\opencv\opencv340\build\include;..\..\3rdparty\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir);$(cudnn)\include + C:\opencv_3.0\opencv\build\include;..\..\3rdparty\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir);$(cudnn)\include OPENCV;CUDNN;_TIMESPEC_DEFINED;_CRT_SECURE_NO_WARNINGS;_CRT_RAND_S;GPU;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) c11 c++1y @@ -147,7 +146,7 @@ true true true - C:\opencv\opencv340\build\x64\vc14\lib;C:\opencv_2.4.13\opencv\build\x64\vc14\lib;C:\opencv_2.4.13\opencv\build\x64\vc12\lib;$(CUDA_PATH)lib\$(PlatformName);$(cudnn)\lib\x64;%(AdditionalLibraryDirectories) + C:\opencv_3.0\opencv\build\x64\vc14\lib;C:\opencv_2.4.13\opencv\build\x64\vc14\lib;C:\opencv_2.4.13\opencv\build\x64\vc12\lib;$(CUDA_PATH)lib\$(PlatformName);$(cudnn)\lib\x64;%(AdditionalLibraryDirectories) ..\..\3rdparty\lib\x64\pthreadVC2.lib;cublas.lib;curand.lib;cudart.lib;%(AdditionalDependencies) $(OutDir)\$(TargetName)$(TargetExt) @@ -289,6 +288,6 @@ - + \ No newline at end of file diff --git a/build/darknet/yolo_cpp_dll.vcxproj b/build/darknet/yolo_cpp_dll.vcxproj index 5deb9d41..c33be37f 100644 --- a/build/darknet/yolo_cpp_dll.vcxproj +++ b/build/darknet/yolo_cpp_dll.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,38 +21,38 @@ {4CF5694F-12A5-4012-8D94-9A0915E9FEB5} darknet - 10.0.17134.0 + 8.1 Application true - v141 + v140 MultiByte DynamicLibrary true - v141 + v140 MultiByte Application false - v141 + v140 true MultiByte DynamicLibrary false - v141 + v140 true MultiByte - + @@ -291,6 +291,6 @@ - + \ No newline at end of file diff --git a/build/darknet/yolo_cpp_dll_no_gpu.vcxproj b/build/darknet/yolo_cpp_dll_no_gpu.vcxproj index 123b96e7..56753c45 100644 --- a/build/darknet/yolo_cpp_dll_no_gpu.vcxproj +++ b/build/darknet/yolo_cpp_dll_no_gpu.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,32 +21,32 @@ {4CF5694F-12A5-4012-8D94-9A0915E9FEB5} darknet - 10.0.17134.0 + 8.1 Application true - v141 + v140 MultiByte DynamicLibrary true - v141 + v140 MultiByte Application false - v141 + v140 true MultiByte DynamicLibrary false - v141 + v140 true MultiByte @@ -111,7 +111,7 @@ true true true - C:\opencv\opencv340\build\include;..\..\3rdparty\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir);$(cudnn)\include + C:\opencv_2.4.9\opencv\build\include;..\..\3rdparty\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir);$(cudnn)\include YOLODLL_EXPORTS;_TIMESPEC_DEFINED;_CRT_SECURE_NO_WARNINGS;GPU;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) true @@ -119,7 +119,7 @@ true true true - C:\opencv\opencv340\build\x64\vc15\lib;$(CUDA_PATH)lib\$(PlatformName);$(cudnn)\lib\x64;%(AdditionalLibraryDirectories) + C:\opencv_2.4.9\opencv\build\x86\vc14\lib;C:\opencv_2.4.9\opencv\build\x86\vc12\lib;$(CUDA_PATH)lib\$(PlatformName);$(cudnn)\lib\x64;%(AdditionalLibraryDirectories) ..\..\3rdparty\lib\x86\pthreadVC2.lib;cudart.lib;cublas.lib;curand.lib;%(AdditionalDependencies) @@ -130,8 +130,8 @@ true true true - ..\..\3rdparty\include;C:\opencv\opencv340\build\include;%(AdditionalIncludeDirectories) - YOLODLL_EXPORTS;_TIMESPEC_DEFINED;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;_LIB;OPENCV;%(PreprocessorDefinitions) + ..\..\3rdparty\include;%(AdditionalIncludeDirectories) + YOLODLL_EXPORTS;_TIMESPEC_DEFINED;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) c11 c++1y CompileAsCpp @@ -140,14 +140,12 @@ true true - - true true true - C:\opencv\opencv340\build\x64\vc15\lib;%(AdditionalLibraryDirectories) + %(AdditionalLibraryDirectories) ..\..\3rdparty\lib\x64\pthreadVC2.lib;%(AdditionalDependencies) $(OutDir)\$(TargetName)$(TargetExt) diff --git a/src/yolo_v2_class.cpp b/src/yolo_v2_class.cpp index 6147e3c4..faaf8d11 100644 --- a/src/yolo_v2_class.cpp +++ b/src/yolo_v2_class.cpp @@ -22,51 +22,6 @@ extern "C" { #define FRAMES 3 -int max_objects() { return C_SHARP_MAX_OBJECTS; } - -static Detector* detector; -//static std::unique_ptr detector; - -int init(const char *configurationFilename, const char *weightsFilename, int gpu) { - std::string configurationFilenameString; - configurationFilenameString = configurationFilename; - std::string weightsFilenameString; - weightsFilenameString = weightsFilename; - - detector = new Detector(configurationFilenameString, weightsFilenameString, gpu); - return 1; -} - -int detect_image(const char *filename, bbox_t_container &container) { - std::string filenameString; - filenameString = filename; - - std::vector detection = detector->detect(filenameString); - for (size_t i = 0; i < detection.size() && i < C_SHARP_MAX_OBJECTS; ++i) - container.candidates[i] = detection[i]; - return detection.size(); -} - -int detect_image2(const uint8_t* data, const size_t data_length, bbox_t_container &container) { -#ifdef OPENCV - std::vector vdata(data, data + data_length); - cv::Mat image = imdecode(cv::Mat(vdata), 1); - - std::vector detection = detector->detect(image); - for (size_t i = 0; i < detection.size() && i < C_SHARP_MAX_OBJECTS; ++i) - container.candidates[i] = detection[i]; - return detection.size(); -#else - return -1; -#endif // OPENCV -} - -int dispose() { - detector->~Detector(); - //detector.reset(); - return 1; -} - #ifdef GPU void check_cuda(cudaError_t status) { if (status != cudaSuccess) { diff --git a/src/yolo_v2_class.hpp b/src/yolo_v2_class.hpp index 2416050b..fd00dc06 100644 --- a/src/yolo_v2_class.hpp +++ b/src/yolo_v2_class.hpp @@ -28,11 +28,6 @@ struct image_t { float *data; // pointer to the image data }; -#define C_SHARP_MAX_OBJECTS 1000 -struct bbox_t_container { - bbox_t candidates[C_SHARP_MAX_OBJECTS]; -}; - #ifdef __cplusplus #include #include @@ -45,12 +40,6 @@ struct bbox_t_container { #include "opencv2/imgproc/imgproc_c.h" // C #endif // OPENCV -extern "C" __declspec(dllexport) int max_objects(); -extern "C" __declspec(dllexport) int init(const char *configurationFilename, const char *weightsFilename, int gpu); -extern "C" __declspec(dllexport) int detect_image(const char *filename, bbox_t_container &container); -extern "C" __declspec(dllexport) int detect_image2(const uint8_t* data, const size_t data_length, bbox_t_container &container); -extern "C" __declspec(dllexport) int dispose(); - class Detector { std::shared_ptr detector_gpu_ptr; std::deque> prev_bbox_vec_deque;