Merge pull request #3654 from cenit/dev/cenit/cudaCMake

re-enable cuda choice
pull/3678/head
Alexey 6 years ago committed by GitHub
commit 4384065158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      .gitignore
  2. 18
      .travis.yml
  3. 72
      CMakeLists.txt
  4. 15
      DarknetConfig.cmake.in
  5. 8
      appveyor.yml
  6. 69
      build.ps1
  7. 10
      build.sh
  8. 13
      include/yolo_v2_class.hpp
  9. 1
      src/col2im.c
  10. 2
      src/data.c
  11. 4
      src/gemm.c
  12. 2
      src/parser.c
  13. 25
      src/yolo_v2_class.cpp

10
.gitignore vendored

@ -8,6 +8,7 @@
*.exe
*.dll
*.lib
*.dylib
mnist/
data/
caffe/
@ -23,6 +24,15 @@ build_*/
!build/darknet/YoloWrapper.cs
.fuse*
*.weights
build/*.cmake
build/*.ninja
build/*.txt
build/*.json
build/CMakeFiles/
build/detect_cuda_compute_capabilities.cu
build/.ninja_deps
build/.ninja_log
build/Makefile
# OS Generated #
.DS_Store*

@ -44,6 +44,13 @@ matrix:
- additional_defines=""
- MATRIX_EVAL=""
- os: osx
compiler: clang
name: macOS - native clang - C++ mode
env:
- additional_defines="-DBUILD_AS_CPP:BOOL=TRUE"
- MATRIX_EVAL=""
- os: osx
compiler: clang
name: macOS - native clang - opencv@2
@ -179,6 +186,16 @@ matrix:
- additional_defines=""
- MATRIX_EVAL=""
- os: linux
compiler: gcc
name: ubuntu 14.04 - native gcc - C++ mode
addons:
apt:
update: true
env:
- additional_defines="-DBUILD_AS_CPP:BOOL=TRUE"
- MATRIX_EVAL=""
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@4.9
@ -942,7 +959,6 @@ install:
- popd
before_script:
- echo ${additional_defines}
- mkdir build_debug
- cd build_debug
- cmake .. -DCMAKE_BUILD_TYPE="Debug" ${VCPKG_DEFINES} ${additional_defines}

@ -7,6 +7,7 @@ set(Darknet_VERSION ${Darknet_MAJOR_VERSION}.${Darknet_MINOR_VERSION}.${Darknet_
set(CMAKE_VERBOSE_MAKEFILE "FALSE" CACHE BOOL "Create verbose makefile")
set(BUILD_SHARED_LIBS "TRUE" CACHE BOOL "Create dark as a shared library")
set(BUILD_AS_CPP "FALSE" CACHE BOOL "Build Darknet using C++ compiler also for C files")
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
@ -38,25 +39,25 @@ set(INSTALL_INCLUDE_DIR "include/darknet" CACHE PATH "Path where head
set(INSTALL_CMAKE_DIR "share/darknet" CACHE PATH "Path where cmake configs will be installed")
set(ENABLE_OPENCV "TRUE" CACHE BOOL "Enable OpenCV integration")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support")
set(ENABLE_CUDA "TRUE" CACHE BOOL "Enable CUDA support")
set(ENABLE_CUDNN "FALSE" CACHE BOOL "Enable CUDNN")
set(ENABLE_CUDNN_HALF "FALSE" CACHE BOOL "Enable CUDNN Half precision")
if(${CMAKE_VERSION} VERSION_LESS "3.9.0")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
message(WARNING "To build with CUDA support you need CMake 3.9.0+")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
else()
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
if(CMAKE_CUDA_COMPILER AND ENABLE_CUDA)
set(CUDA_ARCHITECTURES "Auto" CACHE STRING "\"Auto\" detects local machine GPU compute arch at runtime, \"Common\" and \"All\" cover common and entire subsets of architectures, \"Names\" is a list of architectures to enable by name, \"Numbers\" is a list of compute capabilities (version number) to enable")
set_property(CACHE CUDA_ARCHITECTURES PROPERTY STRINGS "Auto" "Common" "All" "Kepler Maxwell Kepler+Tegra Maxwell+Tegra Pascal" "3.0 7.5")
enable_language(CUDA)
find_package(CUDA REQUIRED)
if(CUDA_VERSION VERSION_LESS "9.0")
message(STATUS "Unsupported CUDA version, please upgrade to CUDA 9+. Disabling CUDA support")
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
else()
set(ENABLE_CUDA "TRUE" CACHE BOOL "Enable CUDA support" FORCE)
cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCHITECTURES})
message(STATUS "Building with CUDA flags: " "${CUDA_ARCH_FLAGS}")
if ("arch=compute_75,code=sm_75" IN_LIST CUDA_ARCH_FLAGS)
@ -64,6 +65,8 @@ else()
message(STATUS "Your setup supports half precision!")
endif()
endif()
else()
set(ENABLE_CUDA "FALSE" CACHE BOOL "Enable CUDA support" FORCE)
endif()
endif()
@ -80,6 +83,30 @@ if(MSVC)
endif()
if(ENABLE_OPENCV)
find_package(OpenCV)
if(OpenCV_FOUND)
if(TARGET opencv_world)
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_world")
else()
if(TARGET opencv_video)
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_video")
endif()
if(TARGET opencv_videoio)
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_videoio")
endif()
if(TARGET opencv_highgui)
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_highgui")
endif()
if(TARGET opencv_imgproc)
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_imgproc")
endif()
if(TARGET opencv_imgcodecs)
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_imgcodecs")
endif()
if(TARGET opencv_core)
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_core")
endif()
endif()
endif()
endif()
find_package(Stb REQUIRED)
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
@ -123,6 +150,13 @@ if(OpenCV_FOUND)
set(SKIP_USELIB_TRACK "TRUE" CACHE BOOL "Skip building uselib_track" FORCE)
message(STATUS " -> darknet is fine for now, but uselib_track has been disabled!")
message(STATUS " -> Please rebuild OpenCV from sources with CUDA support to enable it")
elseif(ENABLE_CUDA AND OpenCV_CUDA_VERSION)
if(TARGET opencv_cudaoptflow)
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_cudaoptflow")
endif()
if(TARGET opencv_cudaimgproc)
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_cudaimgproc")
endif()
endif()
endif()
@ -230,7 +264,9 @@ if(ENABLE_CUDA)
file(GLOB cuda_sources "${CMAKE_CURRENT_LIST_DIR}/src/*.cu")
endif()
#set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX)
if(BUILD_AS_CPP)
set_source_files_properties(${sources} PROPERTIES LANGUAGE CXX)
endif()
add_library(dark ${CMAKE_CURRENT_LIST_DIR}/include/yolo_v2_class.hpp ${CMAKE_CURRENT_LIST_DIR}/src/yolo_v2_class.cpp ${sources} ${headers} ${cuda_sources})
set_target_properties(dark PROPERTIES POSITION_INDEPENDENT_CODE ON)
@ -240,18 +276,24 @@ endif()
if(BUILD_SHARED_LIBS)
target_compile_definitions(dark PRIVATE LIB_EXPORTS=1)
endif()
#set_target_properties(dark PROPERTIES LINKER_LANGUAGE CXX)
if(BUILD_AS_CPP)
set_target_properties(dark PROPERTIES LINKER_LANGUAGE CXX)
endif()
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
add_executable(uselib_track ${CMAKE_CURRENT_LIST_DIR}/src/yolo_console_dll.cpp)
endif()
add_executable(uselib ${CMAKE_CURRENT_LIST_DIR}/src/yolo_console_dll.cpp)
#set_target_properties(uselib PROPERTIES LINKER_LANGUAGE CXX)
if(BUILD_AS_CPP)
set_target_properties(uselib PROPERTIES LINKER_LANGUAGE CXX)
endif()
add_executable(darknet ${CMAKE_CURRENT_LIST_DIR}/src/darknet.c ${sources} ${headers} ${cuda_sources})
#set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/src/darknet.c PROPERTIES LANGUAGE CXX)
#set_target_properties(darknet PROPERTIES LINKER_LANGUAGE CXX)
if(BUILD_AS_CPP)
set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/src/darknet.c PROPERTIES LANGUAGE CXX)
set_target_properties(darknet PROPERTIES LINKER_LANGUAGE CXX)
endif()
target_include_directories(darknet PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:${DARKNET_INSTALL_INCLUDE_DIR}> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>)
target_include_directories(dark PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:${DARKNET_INSTALL_INCLUDE_DIR}> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>)
@ -273,9 +315,9 @@ if(CUDNN_FOUND)
endif()
if(OpenCV_FOUND)
target_link_libraries(darknet PRIVATE ${OpenCV_LIBS})
target_link_libraries(uselib PRIVATE ${OpenCV_LIBS})
target_link_libraries(dark PRIVATE ${OpenCV_LIBS})
target_link_libraries(darknet PRIVATE ${OpenCV_LINKED_COMPONENTS})
target_link_libraries(uselib PRIVATE ${OpenCV_LINKED_COMPONENTS})
target_link_libraries(dark PRIVATE ${OpenCV_LINKED_COMPONENTS})
target_compile_definitions(darknet PRIVATE -DOPENCV)
target_compile_definitions(dark PUBLIC -DOPENCV)
endif()
@ -334,9 +376,11 @@ if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRA
target_link_libraries(uselib_track PRIVATE dark)
target_compile_definitions(uselib_track PRIVATE TRACK_OPTFLOW=1)
target_compile_definitions(uselib_track PRIVATE -DUSE_CMAKE_LIBS)
#set_target_properties(uselib_track PROPERTIES LINKER_LANGUAGE CXX)
if(BUILD_AS_CPP)
set_target_properties(uselib_track PROPERTIES LINKER_LANGUAGE CXX)
endif()
target_include_directories(uselib_track PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(uselib_track PRIVATE ${OpenCV_LIBS})
target_link_libraries(uselib_track PRIVATE ${OpenCV_LINKED_COMPONENTS})
if(ENABLE_ZED_CAMERA)
target_link_libraries(uselib_track PRIVATE ${ZED_LIBRARIES})
target_compile_definitions(uselib_track PRIVATE -DZED_STEREO)

@ -9,9 +9,10 @@ if(@OpenCV_FOUND@)
find_dependency(OpenCV)
endif()
find_dependency(Stb)
if(@ENABLE_CUDA@)
enable_language(CUDA)
find_dependency(CUDA)
cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCHITECTURES})
if(@CUDNN_FOUND@)
find_dependency(CUDNN)
endif()
@ -20,8 +21,9 @@ endif()
set(CMAKE_THREAD_PREFER_PTHREAD ON)
find_dependency(Threads)
if(@MSVC@)
if(MSVC)
find_dependency(PThreads_windows)
set(CMAKE_CXX_FLAGS "/wd4018 /wd4244 /wd4267 /wd4305 ${CMAKE_CXX_FLAGS}")
endif()
if(@OPENMP_FOUND@)
@ -30,3 +32,10 @@ endif()
# Our library dependencies (contains definitions for IMPORTED targets)
include("${Darknet_CMAKE_DIR}/DarknetTargets.cmake")
include("${Darknet_CMAKE_DIR}/DarknetConfigVersion.cmake")
get_target_property(FULL_DARKNET_INCLUDE_DIRS Darknet::dark INTERFACE_INCLUDE_DIRECTORIES)
list(GET FULL_DARKNET_INCLUDE_DIRS 0 Darknet_INCLUDE_DIR)
get_filename_component(Darknet_INCLUDE_DIR "${Darknet_INCLUDE_DIR}" REALPATH)
find_package_handle_standard_args(Darknet REQUIRED_VARS Darknet_INCLUDE_DIR VERSION_VAR PACKAGE_VERSION)

@ -37,6 +37,11 @@ environment:
COMPILER: vs
configuration: Release
USE_INTEGRATED_LIBS: yes
- platform: Win64
COMPILER: vs
configuration: Release
USE_INTEGRATED_LIBS: yes
FORCE_CPP: yes
install:
- if [%COMPILER%]==[vs] cinst cmake ninja
@ -77,7 +82,8 @@ install:
- mkdir build_release && cd build_release
- if [%COMPILER%]==[cygwin] %CYGSH% 'cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release"'
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] if [%configuration%]==[Release] cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=%VCPKG_DEFAULT_TRIPLET%" -DCMAKE_BUILD_TYPE="Release" ..
- if [%COMPILER%]==[vs] if [%USE_INTEGRATED_LIBS%]==[yes] cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" -DCMAKE_BUILD_TYPE="Release" ..
- if [%COMPILER%]==[vs] if [%USE_INTEGRATED_LIBS%]==[yes] if [%FORCE_CPP%]==[yes] cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" -DCMAKE_BUILD_TYPE="Release" "-DBUILD_AS_CPP:BOOL=TRUE" ..
- if [%COMPILER%]==[vs] if [%USE_INTEGRATED_LIBS%]==[yes] cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" -DCMAKE_BUILD_TYPE="Release" ..
- cd ..
build_script:

@ -2,6 +2,8 @@
$number_of_build_workers=8
$use_vcpkg=$true
$use_ninja=$false
$force_cpp_build=$false
function getProgramFiles32bit() {
$out = ${env:PROGRAMFILES(X86)}
@ -112,17 +114,22 @@ if ($null -eq (Get-Command "cl.exe" -ErrorAction SilentlyContinue)) {
$tokens = getLatestVisualStudioWithDesktopWorkloadVersion
$tokens = $tokens.split('.')
if ($tokens[0] -eq "14") {
$generator = "Visual Studio 14 2015"
}
elseif ($tokens[0] -eq "15") {
$generator = "Visual Studio 15 2017"
}
elseif ($tokens[0] -eq "16") {
$generator = "Visual Studio 16 2019"
if($use_ninja) {
$generator = "Ninja"
}
else {
throw "Unknown Visual Studio version, unsupported configuration"
if ($tokens[0] -eq "14") {
$generator = "Visual Studio 14 2015"
}
elseif ($tokens[0] -eq "15") {
$generator = "Visual Studio 15 2017"
}
elseif ($tokens[0] -eq "16") {
$generator = "Visual Studio 16 2019"
}
else {
throw "Unknown Visual Studio version, unsupported configuration"
}
}
Write-Host "Setting up environment to use CMake generator: $generator" -ForegroundColor Yellow
@ -143,29 +150,52 @@ if (Test-Path env:CUDA_PATH) {
}
}
if($force_cpp_build) {
$additional_build_setup="-DBUILD_AS_CPP:BOOL=TRUE"
}
if ($use_vcpkg) {
## DEBUG
#New-Item -Path .\build_win_debug -ItemType directory -Force
#Set-Location build_win_debug
#cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" #"-DCMAKE_BUILD_TYPE=Debug" $additional_build_setup ..
#if ($use_ninja) {
#cmake -G "$generator" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" #"-DCMAKE_BUILD_TYPE=Debug" $additional_build_setup ..
#$dllfolder = "."
#}
#else {
#cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Debug" $additional_build_setup ..
#$dllfolder = "Debug"
#}
#cmake --build . --config Debug --target install
##cmake --build . --config Debug --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+
#Remove-Item DarknetConfig.cmake
#Remove-Item DarknetConfigVersion.cmake
#Copy-Item Debug\*.dll ..
#$dllfiles = Get-ChildItem ${dllfolder}\*.dll
#if ($dllfiles) {
# Copy-Item $dllfiles ..
#}
#Set-Location ..
#Copy-Item cmake\Modules\*.cmake share\darknet\
# RELEASE
New-Item -Path .\build_win_release -ItemType directory -Force
Set-Location build_win_release
cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Release" $additional_build_setup ..
if($use_ninja) {
cmake -G "$generator" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Release" $additional_build_setup ..
$dllfolder = "."
}
else {
cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Release" $additional_build_setup ..
$dllfolder = "Release"
}
cmake --build . --config Release --target install
#cmake --build . --config Release --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+
Remove-Item DarknetConfig.cmake
Remove-Item DarknetConfigVersion.cmake
Copy-Item Release\*.dll ..
$dllfiles = Get-ChildItem ${dllfolder}\*.dll
if ($dllfiles) {
Copy-Item $dllfiles ..
}
Set-Location ..
Copy-Item cmake\Modules\*.cmake share\darknet\
}
@ -174,12 +204,21 @@ else {
# if you want to manually force this case, remove VCPKG_ROOT env variable and remember to use "vcpkg integrate remove" in case you had enabled user-wide vcpkg integration
New-Item -Path .\build_win_release_novcpkg -ItemType directory -Force
Set-Location build_win_release_novcpkg
cmake -G "$generator" -T "host=x64" -A "x64" $additional_build_setup ..
if($use_ninja) {
cmake -G "$generator" $additional_build_setup ..
}
else {
cmake -G "$generator" -T "host=x64" -A "x64" $additional_build_setup ..
}
cmake --build . --config Release --target install
#cmake --build . --config Release --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+
Remove-Item DarknetConfig.cmake
Remove-Item DarknetConfigVersion.cmake
Copy-Item ..\3rdparty\pthreads\bin\*.dll ..
$dllfolder = "..\3rdparty\pthreads\bin"
$dllfiles = Get-ChildItem ${dllfolder}\*.dll
if ($dllfiles) {
Copy-Item $dllfiles ..
}
Set-Location ..
Copy-Item cmake\Modules\*.cmake share\darknet\
}

@ -2,12 +2,9 @@
number_of_build_workers=8
bypass_vcpkg=true
force_cpp_build=false
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ "$1" == "gcc" ]]; then
export CC="/usr/local/bin/gcc-8"
export CXX="/usr/local/bin/g++-8"
fi
vcpkg_triplet="x64-osx"
else
vcpkg_triplet="x64-linux"
@ -30,6 +27,11 @@ then
(>&2 echo "darknet is unsupported without vcpkg, use at your own risk!")
fi
if [ "$force_cpp_build" = true ]
then
additional_build_setup="-DBUILD_AS_CPP:BOOL=TRUE"
fi
## DEBUG
#mkdir -p build_debug
#cd build_debug

@ -62,6 +62,9 @@ extern "C" LIB_API int detect_mat(const uint8_t* data, const size_t data_length,
extern "C" LIB_API int dispose();
extern "C" LIB_API int get_device_count();
extern "C" LIB_API int get_device_name(int gpu, char* deviceName);
extern "C" LIB_API bool built_with_cuda();
extern "C" LIB_API bool built_with_cudnn();
extern "C" LIB_API bool built_with_opencv();
extern "C" LIB_API void send_json_custom(char const* send_buf, int port, int timeout);
class Detector {
@ -88,7 +91,7 @@ public:
LIB_API void *get_cuda_context();
//LIB_API bool send_json_http(std::vector<bbox_t> cur_bbox_vec, std::vector<std::string> obj_names, int frame_id,
//LIB_API bool send_json_http(std::vector<bbox_t> cur_bbox_vec, std::vector<std::string> obj_names, int frame_id,
// std::string filename = std::string(), int timeout = 400000, int port = 8070);
std::vector<bbox_t> detect_resized(image_t img, int init_w, int init_h, float thresh = 0.2, bool use_mean = false)
@ -477,7 +480,7 @@ public:
else {
std::cerr << " Warning: new_src_mat.channels() is not: 1, 3 or 4. It is = " << new_src_mat.channels() << " \n";
return;
}
}
update_cur_bbox_vec(_cur_bbox_vec);
}
@ -691,7 +694,7 @@ public:
};
class track_kalman_t
class track_kalman_t
{
int track_id_counter;
std::chrono::steady_clock::time_point global_last_time;
@ -847,7 +850,7 @@ public:
track_kalman_t(int _max_objects = 1000, int _min_frames = 3, float _max_dist = 40, cv::Size _img_size = cv::Size(10000, 10000)) :
max_objects(_max_objects), min_frames(_min_frames), max_dist(_max_dist), img_size(_img_size),
max_objects(_max_objects), min_frames(_min_frames), max_dist(_max_dist), img_size(_img_size),
track_id_counter(0)
{
kalman_vec.resize(max_objects);
@ -917,7 +920,7 @@ public:
busy_vec[tst.state_id] = true;
}
else {
//std::cerr << " Didn't find: obj_id = " << find_box.obj_id << ", x = " << find_box.x << ", y = " << find_box.y <<
//std::cerr << " Didn't find: obj_id = " << find_box.obj_id << ", x = " << find_box.x << ", y = " << find_box.y <<
// ", track_id_counter = " << track_id_counter << std::endl;
}

@ -1,5 +1,6 @@
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "col2im.h"
void col2im_add_pixel(float *im, int height, int width, int channels,
int row, int col, int channel, int pad, float val)

@ -937,7 +937,7 @@ data load_data_detection(int n, char **paths, int m, int w, int h, int c, int bo
{
image tmp_ai = copy_image(ai);
char buff[1000];
sprintf(buff, "aug_%d_%d_%s_%d", random_index, i, basecfg(filename), random_gen());
sprintf(buff, "aug_%d_%d_%s_%d", random_index, i, basecfg((char*)filename), random_gen());
int t;
for (t = 0; t < boxes; ++t) {
box b = float_to_box_stride(d.y.vals[i] + t*(4 + 1), 1);

@ -1120,8 +1120,10 @@ void convolution_2d(int w, int h, int ksize, int n, int c, int pad, int stride,
static inline int popcnt128(__m128i n) {
const __m128i n_hi = _mm_unpackhi_epi64(n, n);
#ifdef _MSC_VER
#if defined(_MSC_VER)
return __popcnt64(_mm_cvtsi128_si64(n)) + __popcnt64(_mm_cvtsi128_si64(n_hi));
#elif defined(__APPLE__) && defined(__clang__)
return _mm_popcnt_u64(_mm_cvtsi128_si64(n)) + _mm_popcnt_u64(_mm_cvtsi128_si64(n_hi));
#else
return __popcntq(_mm_cvtsi128_si64(n)) + __popcntq(_mm_cvtsi128_si64(n_hi));
#endif

@ -167,7 +167,7 @@ convolutional_layer parse_convolutional(list *options, size_params params, netwo
int share_index = option_find_int_quiet(options, "share_index", -1);
convolutional_layer *share_layer = NULL;
if(share_layer > -1) share_layer = &net.layers[share_index];
if(share_index > -1) share_layer = &net.layers[share_index];
int batch,h,w,c;
h = params.h;

@ -72,6 +72,31 @@ int get_device_count() {
#endif // GPU
}
bool built_with_cuda(){
#ifdef GPU
return true;
#else
return false;
#endif
}
bool built_with_cudnn(){
#ifdef CUDNN
return true;
#else
return false;
#endif
}
bool built_with_opencv(){
#ifdef OPENCV
return true;
#else
return false;
#endif
}
int get_device_name(int gpu, char* deviceName) {
#ifdef GPU
cudaDeviceProp prop;

Loading…
Cancel
Save