Skip to content

Commit

Permalink
Merge branch 'AlexeyAB:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Tossy0423 authored Jul 11, 2021
2 parents 994c180 + 9c26b29 commit 86267f8
Show file tree
Hide file tree
Showing 64 changed files with 17,301 additions and 832 deletions.
309 changes: 218 additions & 91 deletions .github/workflows/ccpp.yml

Large diffs are not rendered by default.

429 changes: 429 additions & 0 deletions .github/workflows/on_pr.yml

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Automatic Rebase
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'CONTRIBUTOR')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: Automatic Rebase
uses: cirrus-actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.dll
*.lib
*.dylib
*.pyc
mnist/
data/
caffe/
Expand All @@ -22,6 +23,8 @@ cfg/
temp/
build/darknet/*
build_*/
ninja/
ninja.zip
vcpkg_installed/
!build/darknet/YoloWrapper.cs
.fuse*
Expand All @@ -36,6 +39,8 @@ build/.ninja_deps
build/.ninja_log
build/Makefile
*/vcpkg-manifest-install.log
build.log
__pycache__/

# OS Generated #
.DS_Store*
Expand Down
60 changes: 0 additions & 60 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,6 @@ matrix:
- additional_defines=" -DENABLE_CUDA=OFF -DENABLE_CUDNN=OFF -DENABLE_OPENCV=OFF"
- MATRIX_EVAL=""

- os: osx
compiler: gcc
name: macOS - gcc (llvm backend) - opencv@2
osx_image: xcode12.3
env:
- OpenCV_DIR="/usr/local/opt/opencv@2/"
- additional_defines="-DOpenCV_DIR=${OpenCV_DIR} -DENABLE_CUDA=OFF"
- MATRIX_EVAL="brew install opencv@2"

- os: osx
compiler: gcc
name: macOS - gcc (llvm backend) - opencv@3
osx_image: xcode12.3
env:
- OpenCV_DIR="/usr/local/opt/opencv@3/"
- additional_defines="-DOpenCV_DIR=${OpenCV_DIR} -DENABLE_CUDA=OFF"
- MATRIX_EVAL="brew install opencv@3"

- os: osx
compiler: gcc
name: macOS - gcc (llvm backend) - opencv(latest)
osx_image: xcode12.3
env:
- additional_defines=" -DENABLE_CUDA=OFF"
- MATRIX_EVAL="brew install opencv"

- os: osx
compiler: clang
name: macOS - clang
Expand All @@ -58,40 +32,6 @@ matrix:
- additional_defines="-DBUILD_AS_CPP:BOOL=TRUE -DENABLE_CUDA=OFF -DENABLE_CUDNN=OFF -DENABLE_OPENCV=OFF"
- MATRIX_EVAL=""

- os: osx
compiler: clang
name: macOS - clang - opencv@2
osx_image: xcode12.3
env:
- OpenCV_DIR="/usr/local/opt/opencv@2/"
- additional_defines="-DOpenCV_DIR=${OpenCV_DIR} -DENABLE_CUDA=OFF"
- MATRIX_EVAL="brew install opencv@2"

- os: osx
compiler: clang
name: macOS - clang - opencv@3
osx_image: xcode12.3
env:
- OpenCV_DIR="/usr/local/opt/opencv@3/"
- additional_defines="-DOpenCV_DIR=${OpenCV_DIR} -DENABLE_CUDA=OFF"
- MATRIX_EVAL="brew install opencv@3"

- os: osx
compiler: clang
name: macOS - clang - opencv(latest)
osx_image: xcode12.3
env:
- additional_defines=" -DENABLE_CUDA=OFF"
- MATRIX_EVAL="brew install opencv"

- os: osx
compiler: clang
name: macOS - clang - opencv(latest) - libomp
osx_image: xcode12.3
env:
- additional_defines=" -DENABLE_CUDA=OFF"
- MATRIX_EVAL="brew install opencv libomp"

- os: linux
compiler: clang
dist: bionic
Expand Down
88 changes: 65 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set(Darknet_PATCH_VERSION 5)
set(Darknet_TWEAK_VERSION 4)
set(Darknet_VERSION ${Darknet_MAJOR_VERSION}.${Darknet_MINOR_VERSION}.${Darknet_PATCH_VERSION}.${Darknet_TWEAK_VERSION})

message("Darknet_VERSION: ${Darknet_VERSION}")

option(CMAKE_VERBOSE_MAKEFILE "Create verbose makefile" ON)
option(CUDA_VERBOSE_BUILD "Create verbose CUDA build" ON)
option(BUILD_SHARED_LIBS "Create dark as a shared library" ON)
Expand All @@ -19,30 +21,49 @@ option(ENABLE_CUDNN "Enable CUDNN" ON)
option(ENABLE_CUDNN_HALF "Enable CUDNN Half precision" ON)
option(ENABLE_ZED_CAMERA "Enable ZED Camera support" ON)
option(ENABLE_VCPKG_INTEGRATION "Enable VCPKG integration" ON)
option(ENABLE_CSHARP_WRAPPER "Enable building a csharp wrapper" OFF)
option(VCPKG_BUILD_OPENCV_WITH_CUDA "Build OpenCV with CUDA extension integration" ON)
option(VCPKG_USE_OPENCV2 "Use legacy OpenCV 2" OFF)
option(VCPKG_USE_OPENCV3 "Use legacy OpenCV 3" OFF)
option(VCPKG_USE_OPENCV4 "Use OpenCV 4" ON)

if(ENABLE_OPENCV_WITH_CUDA AND NOT APPLE)
list(APPEND VCPKG_MANIFEST_FEATURES "opencv-cuda")
if(VCPKG_USE_OPENCV4 AND VCPKG_USE_OPENCV2)
message(STATUS "You required vcpkg feature related to OpenCV 2 but forgot to turn off those for OpenCV 4, doing that for you")
set(VCPKG_USE_OPENCV4 OFF CACHE BOOL "Use OpenCV 4" FORCE)
endif()
if(VCPKG_USE_OPENCV4 AND VCPKG_USE_OPENCV3)
message(STATUS "You required vcpkg feature related to OpenCV 3 but forgot to turn off those for OpenCV 4, doing that for you")
set(VCPKG_USE_OPENCV4 OFF CACHE BOOL "Use OpenCV 4" FORCE)
endif()
if(VCPKG_USE_OPENCV2 AND VCPKG_USE_OPENCV3)
message(STATUS "You required vcpkg features related to both OpenCV 2 and OpenCV 3. Impossible to satisfy, keeping only OpenCV 3")
set(VCPKG_USE_OPENCV2 OFF CACHE BOOL "Use legacy OpenCV 2" FORCE)
endif()

if(ENABLE_CUDA AND NOT APPLE)
list(APPEND VCPKG_MANIFEST_FEATURES "cuda")
endif()
if(ENABLE_OPENCV)
list(APPEND VCPKG_MANIFEST_FEATURES "opencv-base")
endif()
if(ENABLE_CUDNN AND ENABLE_CUDA AND NOT APPLE)
list(APPEND VCPKG_MANIFEST_FEATURES "cudnn")
endif()

if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_COMPILER_IS_GNUCC_OR_CLANG TRUE)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_COMPILER_IS_CLANG TRUE)
if(ENABLE_OPENCV)
if(VCPKG_BUILD_OPENCV_WITH_CUDA AND NOT APPLE)
if(VCPKG_USE_OPENCV4)
list(APPEND VCPKG_MANIFEST_FEATURES "opencv-cuda")
elseif(VCPKG_USE_OPENCV3)
list(APPEND VCPKG_MANIFEST_FEATURES "opencv3-cuda")
elseif(VCPKG_USE_OPENCV2)
list(APPEND VCPKG_MANIFEST_FEATURES "opencv2-cuda")
endif()
else()
set(CMAKE_COMPILER_IS_CLANG FALSE)
if(VCPKG_USE_OPENCV4)
list(APPEND VCPKG_MANIFEST_FEATURES "opencv-base")
elseif(VCPKG_USE_OPENCV3)
list(APPEND VCPKG_MANIFEST_FEATURES "opencv3-base")
elseif(VCPKG_USE_OPENCV2)
list(APPEND VCPKG_MANIFEST_FEATURES "opencv2-base")
endif()
endif()
else()
set(CMAKE_COMPILER_IS_GNUCC_OR_CLANG FALSE)
set(CMAKE_COMPILER_IS_CLANG FALSE)
endif()

if(NOT CMAKE_HOST_SYSTEM_PROCESSOR AND NOT WIN32)
Expand Down Expand Up @@ -87,6 +108,18 @@ enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})

if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_COMPILER_IS_GNUCC_OR_CLANG TRUE)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "clang")
set(CMAKE_COMPILER_IS_CLANG TRUE)
else()
set(CMAKE_COMPILER_IS_CLANG FALSE)
endif()
else()
set(CMAKE_COMPILER_IS_GNUCC_OR_CLANG FALSE)
set(CMAKE_COMPILER_IS_CLANG FALSE)
endif()

set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
Expand Down Expand Up @@ -201,12 +234,14 @@ endif()

set(ADDITIONAL_CXX_FLAGS "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -Wno-deprecated-declarations -Wno-write-strings")
set(ADDITIONAL_C_FLAGS "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -Wno-deprecated-declarations -Wno-write-strings")
if(UNIX AND BUILD_SHARED_LIBS AND NOT CMAKE_COMPILER_IS_CLANG)
set(SHAREDLIB_CXX_FLAGS "-Wl,-Bsymbolic")
set(SHAREDLIB_C_FLAGS "-Wl,-Bsymbolic")
endif()

if(MSVC)
set(ADDITIONAL_CXX_FLAGS "/wd4013 /wd4018 /wd4028 /wd4047 /wd4068 /wd4090 /wd4101 /wd4113 /wd4133 /wd4190 /wd4244 /wd4267 /wd4305 /wd4477 /wd4996 /wd4819 /fp:fast")
set(ADDITIONAL_C_FLAGS "/wd4013 /wd4018 /wd4028 /wd4047 /wd4068 /wd4090 /wd4101 /wd4113 /wd4133 /wd4190 /wd4244 /wd4267 /wd4305 /wd4477 /wd4996 /wd4819 /fp:fast")
set(CMAKE_CXX_FLAGS "${ADDITIONAL_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${ADDITIONAL_C_FLAGS} ${CMAKE_C_FLAGS}")
string(REGEX REPLACE "/O2" "/Ox" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
string(REGEX REPLACE "/O2" "/Ox" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
endif()
Expand All @@ -218,8 +253,6 @@ if(CMAKE_COMPILER_IS_GNUCC_OR_CLANG)
set(CMAKE_C_FLAGS "-pthread ${CMAKE_C_FLAGS}")
endif()
endif()
set(CMAKE_CXX_FLAGS "${ADDITIONAL_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${ADDITIONAL_C_FLAGS} ${CMAKE_C_FLAGS}")
string(REGEX REPLACE "-O0" "-Og" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
string(REGEX REPLACE "-O3" "-Ofast" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
string(REGEX REPLACE "-O0" "-Og" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
Expand All @@ -230,18 +263,23 @@ if(CMAKE_COMPILER_IS_GNUCC_OR_CLANG)
endif()
endif()

set(CMAKE_CXX_FLAGS "${ADDITIONAL_CXX_FLAGS} ${SHAREDLIB_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${ADDITIONAL_C_FLAGS} ${SHAREDLIB_C_FLAGS} ${CMAKE_C_FLAGS}")

if(OpenCV_FOUND)
if(ENABLE_CUDA AND NOT OpenCV_CUDA_VERSION)
set(BUILD_USELIB_TRACK "FALSE" CACHE BOOL "Build 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(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()
elseif(ENABLE_CUDA AND NOT OpenCV_CUDA_VERSION)
set(BUILD_USELIB_TRACK "FALSE" CACHE BOOL "Build 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")
else()
set(BUILD_USELIB_TRACK "FALSE" CACHE BOOL "Build uselib_track" FORCE)
endif()
endif()

Expand Down Expand Up @@ -539,3 +577,7 @@ install(FILES
"${PROJECT_BINARY_DIR}/DarknetConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}"
)

if(ENABLE_CSHARP_WRAPPER)
add_subdirectory(src/csharp)
endif()
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ LDFLAGS+= -L/usr/local/zed/lib -lsl_zed
endif
endif

OBJ=image_opencv.o http_stream.o gemm.o utils.o dark_cuda.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o parser.o option_list.o darknet.o detection_layer.o captcha.o route_layer.o writing.o box.o nightmare.o normalization_layer.o avgpool_layer.o coco.o dice.o yolo.o detector.o layer.o compare.o classifier.o local_layer.o swag.o shortcut_layer.o activation_layer.o rnn_layer.o gru_layer.o rnn.o rnn_vid.o crnn_layer.o demo.o tag.o cifar.o go.o batchnorm_layer.o art.o region_layer.o reorg_layer.o reorg_old_layer.o super.o voxel.o tree.o yolo_layer.o gaussian_yolo_layer.o upsample_layer.o lstm_layer.o conv_lstm_layer.o scale_channels_layer.o sam_layer.o
OBJ=image_opencv.o http_stream.o gemm.o utils.o dark_cuda.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o parser.o option_list.o darknet.o detection_layer.o captcha.o route_layer.o writing.o box.o nightmare.o normalization_layer.o avgpool_layer.o coco.o dice.o yolo.o detector.o layer.o compare.o classifier.o local_layer.o swag.o shortcut_layer.o representation_layer.o activation_layer.o rnn_layer.o gru_layer.o rnn.o rnn_vid.o crnn_layer.o demo.o tag.o cifar.o go.o batchnorm_layer.o art.o region_layer.o reorg_layer.o reorg_old_layer.o super.o voxel.o tree.o yolo_layer.o gaussian_yolo_layer.o upsample_layer.o lstm_layer.o conv_lstm_layer.o scale_channels_layer.o sam_layer.o
ifeq ($(GPU), 1)
LDFLAGS+= -lstdc++
OBJ+=convolutional_kernels.o activation_kernels.o im2col_kernels.o col2im_kernels.o blas_kernels.o crop_layer_kernels.o dropout_layer_kernels.o maxpool_layer_kernels.o network_kernels.o avgpool_layer_kernels.o
Expand Down
Loading

0 comments on commit 86267f8

Please sign in to comment.