开源!适用于Win和Linux平台的YOLO4和YOLO3( 四 )

  • CUDNN_HALF=1 to build for Tensor Cores (on Titan V / Tesla V100 / DGX-2 and later) speedup Detection 3x, Training 2x
  • OPENCV=1 to build with OpenCV 4.x/3.x/2.4.x - allows to detect on video files and video streams from network cameras or web-cams
  • DEBUG=1 to bould debug version of Yolo
  • OPENMP=1 to build with OpenMP support to accelerate Yolo by using multi-core CPU
  • LIBSO=1 to build a library darknet.so and binary runable file uselib that uses this library. Or you can try to run so LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib test.mp4 How to use this SO-library from your own code - you can look at C++ example: https://github.com/AlexeyAB/darknet/blob/master/src/yolo_console_dll.cpp or use in such a way: LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib data/coco.names cfg/yolov4.cfg yolov4.weights test.mp4
  • ZED_CAMERA=1 to build a library with ZED-3D-camera support (should be ZED SDK installed), then run LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib data/coco.names cfg/yolov4.cfg yolov4.weights zed_camera
  • To run Darknet on Linux use examples from this article, just use ./darknet instead of darknet.exe, i.e. use this command: ./darknet detector test ./cfg/coco.data ./cfg/yolov4.cfg ./yolov4.weights
    How to compile on Windows (using CMake)This is the recommended approach to build Darknet on Windows if you have already installed Visual Studio 2015/2017/2019, CUDA >= 10.0, cuDNN >= 7.0, and OpenCV >= 2.4.
    Open a Powershell terminal inside the cloned repository and launch:
    .build.ps1How to compile on Windows (using vcpkg)
    1. Install or update Visual Studio to at least version 2017, making sure to have it fully patched (run again the installer if not sure to automatically update to latest version). If you need to install from scratch, download VS from here: Visual Studio Community
    2. Install CUDA
    3. Install vcpkg and try to install a test library to make sure everything is working, for example vcpkg install opengl
    4. Open Powershell and type these commands:
    PS >cd vcpkgPS Codevcpkg>.vcpkg install darknet[full]:x64-windows #replace with darknet[opencv-base,weights]:x64-windows for a quicker install; use --head if you want to build latest commit on master branch and not latest release
    1. You will find darknet inside the vcpkginstalled\x64-windowstoolsdarknet folder, together with all the necessary weight and cfg files
    How to compile on Windows (legacy way)
    1. If you have CUDA 10.0, cuDNN 7.4 and OpenCV 3.x (with paths: C:opencv_3.0opencvbuildinclude & C:opencv_3.0opencvbuild\x64vc14lib), then open builddarknetdarknet.sln, set x64 and Release https://hsto.org/webt/uh/fk/-e/uhfk-eb0q-hwd9hsxhrikbokd6u.jpeg and do the: Build -> Build darknet. Also add Windows system variable CUDNN with path to CUDNN: https://user-images.githubusercontent.com/4096485/53249764-019ef880-36ca-11e9-8ffe-d9cf47e7e462.jpg1.1. Find files opencv_world320.dll and opencv_ffmpeg320_64.dll (or opencv_world340.dll and opencv_ffmpeg340_64.dll) in C:opencv_3.0opencvbuild\x64vc14bin and put it near with darknet.exe1.2 Check that there are bin and include folders in the C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.0 if aren't, then copy them to this folder from the path where is CUDA installed1.3. To install CUDNN (speedup neural network), do the following:download and install cuDNN v7.4.1 for CUDA 10.0: https://developer.nvidia.com/rdp/cudnn-archiveadd Windows system variable CUDNN with path to CUDNN: https://user-images.githubusercontent.com/4096485/53249764-019ef880-36ca-11e9-8ffe-d9cf47e7e462.jpgcopy file cudnn64_7.dll to the folder builddarknet\x64 near with darknet.exe1.4. If you want to build without CUDNN then: open darknet.sln -> (right click on project) -> properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, and remove this: CUDNN;
    2. If you have other version of CUDA (not 10.0) then open builddarknetdarknet.vcxproj by using Notepad, find 2 places with "CUDA 10.0" and change it to your CUDA-version. Then open darknet.sln -> (right click on project) -> properties -> CUDA C/C++ -> Device and remove there ;compute_75,sm_75. Then do step 1
    3. If you don't have GPU, but have OpenCV 3.0 (with paths: C:opencv_3.0opencvbuildinclude & C:opencv_3.0opencvbuild\x64vc14lib), then open builddarknetdarknet_no_gpu.sln, set x64 and Release, and do the: Build -> Build darknet_no_gpu
    4. If you have OpenCV 2.4.13 instead of 3.0 then you should change paths after darknet.sln is opened4.1 (right click on project) -> properties -> C/C++ -> General -> Additional Include Directories: C:opencv_2.4.13opencvbuildinclude4.2 (right click on project) -> properties -> Linker -> General -> Additional Library Directories: C:opencv_2.4.13opencvbuild\x64vc14lib
    5. If you have GPU with Tensor Cores (nVidia Titan V / Tesla V100 / DGX-2 and later) speedup Detection 3x, Training 2x: darknet.sln -> (right click on project) -> properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, and add here: CUDNN_HALF;Note: CUDA must be installed only after Visual Studio has been installed.


      推荐阅读