From 69601cd8b0860156a5fca0a61580bf10fe5aa367 Mon Sep 17 00:00:00 2001 From: acxz Date: Mon, 10 Jun 2019 12:44:18 -0400 Subject: [PATCH 1/4] added cmake build instructions and reorganized some install instructions --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 52df1199..97b0bae8 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,12 @@ More details: http://pjreddie.com/darknet/yolo/ 0. [Improvements in this repository](#improvements-in-this-repository) 1. [How to use](#how-to-use-on-the-command-line) -2. [How to compile on Linux](#how-to-compile-on-linux) +2. How to compile on Linux + * [Using cmake](#how-to-compile-on-linux-using-cmake) + * [Using make](#how-to-compile-on-linux-using-make) 3. How to compile on Windows * [Using vcpkg](#how-to-compile-on-windows-using-vcpkg) + * [Using Cmake-GUI](#how-to-compile-on-windows-using-Cmake-GUI) * [Legacy way](#how-to-compile-on-windows-legacy-way) 4. [How to train (Pascal VOC Data)](#how-to-train-pascal-voc-data) 5. [How to train with multi-GPU:](#how-to-train-with-multi-gpu) @@ -50,10 +53,6 @@ More details: http://pjreddie.com/darknet/yolo/ * **GPU with CC >= 3.0**: https://en.wikipedia.org/wiki/CUDA#GPUs_supported * on Linux **GCC or Clang**, on Windows **MSVC 2015/2017/2019** https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community -Compiling on **Windows** by using `Cmake-GUI` as on this [**IMAGE**](https://user-images.githubusercontent.com/4096485/55107892-6becf380-50e3-11e9-9a0a-556a943c429a.png): Configure -> Optional platform for generator (Set: x64) -> Finish -> Generate -> Open Project -> x64 & Release -> Build -> Build solution - -Compiling on **Linux** by using command `make` (or alternative way by using command: `cmake . && make` ) - #### Pre-trained models There are weights-file for different cfg-files (smaller size -> faster speed & lower accuracy: @@ -154,7 +153,23 @@ On Linux find executable file `./darknet` in the root directory, while on Window * Yolo v3 COCO-model: `darknet.exe detector demo data/coco.data yolov3.cfg yolov3.weights http://192.168.0.80:8080/video?dummy=param.mjpg -i 0` -### How to compile on Linux +### How to compile on Linux (using `cmake`) + +The `CMakeLists.txt` will attempt to find installed optional dependencies like +CUDA, cudnn, ZED and build against those. It will also create a shared object +library file to use `darknet` for code development. + +Inside the cloned repository: + +``` +mkdir build-release +cd build-release +cmake .. +make +make install +``` + +### How to compile on Linux (using `make`) Just do `make` in the darknet directory. Before make, you can set such options in the `Makefile`: [link](https://github.com/AlexeyAB/darknet/blob/9c1b9a2cf6363546c152251be578a21f3c3caec6/Makefile#L1) @@ -201,6 +216,19 @@ PS Code\vcpkg> .\vcpkg install pthreads opencv[ffmpeg] #replace with ope 9. Open Powershell, go to the `darknet` folder and build with the command `.\build.ps1`. If you want to use Visual Studio, you will find two custom solutions created for you by CMake after the build, one in `build_win_debug` and the other in `build_win_release`, containing all the appropriate config flags for your system. +### How to compile on Windows (using `Cmake-GUI`) + +Using `Cmake-GUI` as shown here on this [**IMAGE**](https://user-images.githubusercontent.com/4096485/55107892-6becf380-50e3-11e9-9a0a-556a943c429a.png): + +1. Configure +2. Optional platform for generator (Set: x64) +3. Finish +4. Generate +5. Open Project +6. x64 & Release +7. Build +8. Build solution + ### 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.0\opencv\build\include` & `C:\opencv_3.0\opencv\build\x64\vc14\lib`), then open `build\darknet\darknet.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.jpg @@ -596,8 +624,12 @@ With example of: `train.txt`, `obj.names`, `obj.data`, `yolo-obj.cfg`, `air`1-6` ## How to use Yolo as DLL and SO libraries -* on Linux - set `LIBSO=1` in the `Makefile` and do `make` -* on Windows - compile `build\darknet\yolo_cpp_dll.sln` or `build\darknet\yolo_cpp_dll_no_gpu.sln` solution +* on Linux + * build `darknet` using `cmake` or + * set `LIBSO=1` in the `Makefile` and do `make` +* on Windows + * compile `build\darknet\yolo_cpp_dll.sln` solution or + * compile `build\darknet\yolo_cpp_dll_no_gpu.sln` solution There are 2 APIs: * C API: https://github.com/AlexeyAB/darknet/blob/master/include/darknet.h From fead96a0022eb5b160f87324478d41c60f5166a9 Mon Sep 17 00:00:00 2001 From: acxz Date: Mon, 10 Jun 2019 13:00:05 -0400 Subject: [PATCH 2/4] fixed link to cmake-gui section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 97b0bae8..521c2ab5 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ More details: http://pjreddie.com/darknet/yolo/ * [Using make](#how-to-compile-on-linux-using-make) 3. How to compile on Windows * [Using vcpkg](#how-to-compile-on-windows-using-vcpkg) - * [Using Cmake-GUI](#how-to-compile-on-windows-using-Cmake-GUI) + * [Using Cmake-GUI](#how-to-compile-on-windows-using-cmake-gui) * [Legacy way](#how-to-compile-on-windows-legacy-way) 4. [How to train (Pascal VOC Data)](#how-to-train-pascal-voc-data) 5. [How to train with multi-GPU:](#how-to-train-with-multi-gpu) From de07ab6924913c868e8d4bc1e24a5167e8e20a66 Mon Sep 17 00:00:00 2001 From: acxz Date: Wed, 12 Jun 2019 12:14:25 -0400 Subject: [PATCH 3/4] added more ways to create so an dll files --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 521c2ab5..2f85a17c 100644 --- a/README.md +++ b/README.md @@ -625,11 +625,13 @@ With example of: `train.txt`, `obj.names`, `obj.data`, `yolo-obj.cfg`, `air`1-6` ## How to use Yolo as DLL and SO libraries * on Linux + * using `build.sh` or * build `darknet` using `cmake` or * set `LIBSO=1` in the `Makefile` and do `make` * on Windows - * compile `build\darknet\yolo_cpp_dll.sln` solution or - * compile `build\darknet\yolo_cpp_dll_no_gpu.sln` solution + * using `build.ps1` or + * build `darknet` using `cmake` or + * compile `build\darknet\yolo_cpp_dll.sln` solution or `build\darknet\yolo_cpp_dll_no_gpu.sln` solution There are 2 APIs: * C API: https://github.com/AlexeyAB/darknet/blob/master/include/darknet.h From 0823d04247573d5371733ce6755ba143e1591108 Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Fri, 18 Oct 2019 19:24:49 -0400 Subject: [PATCH 4/4] Add readability changes Make CMake-GUI install more visible than vcpkg install --- README.md | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 2f85a17c..8f14d167 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ More details: http://pjreddie.com/darknet/yolo/ * [Using cmake](#how-to-compile-on-linux-using-cmake) * [Using make](#how-to-compile-on-linux-using-make) 3. How to compile on Windows + * [Using CMake-GUI](#how-to-compile-on-windows-using-cmake-gui) * [Using vcpkg](#how-to-compile-on-windows-using-vcpkg) - * [Using Cmake-GUI](#how-to-compile-on-windows-using-cmake-gui) * [Legacy way](#how-to-compile-on-windows-legacy-way) 4. [How to train (Pascal VOC Data)](#how-to-train-pascal-voc-data) 5. [How to train with multi-GPU:](#how-to-train-with-multi-gpu) @@ -159,7 +159,7 @@ The `CMakeLists.txt` will attempt to find installed optional dependencies like CUDA, cudnn, ZED and build against those. It will also create a shared object library file to use `darknet` for code development. -Inside the cloned repository: +Do inside the cloned repository: ``` mkdir build-release @@ -187,9 +187,28 @@ Before make, you can set such options in the `Makefile`: [link](https://github.c 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/yolov3.cfg ./yolov3.weights` +### How to compile on Windows (using `CMake-GUI`) + +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. + +Use `CMake-GUI` as shown here on this [**IMAGE**](https://user-images.githubusercontent.com/4096485/55107892-6becf380-50e3-11e9-9a0a-556a943c429a.png): + +1. Configure +2. Optional platform for generator (Set: x64) +3. Finish +4. Generate +5. Open Project +6. Set: x64 & Release +7. Build +8. Build solution + ### How to compile on Windows (using `vcpkg`) -If you have already installed Visual Studio 2015/2017/2019, CUDA > 10.0, cuDNN > 7.0, OpenCV > 2.4, then compile Darknet by using `C:\Program Files\CMake\bin\cmake-gui.exe` as on this [**IMAGE**](https://user-images.githubusercontent.com/4096485/55107892-6becf380-50e3-11e9-9a0a-556a943c429a.png): Configure -> Optional platform for generator (Set: x64) -> Finish -> Generate -> Open Project -> x64 & Release -> Build -> Build solution +If you have already installed Visual Studio 2015/2017/2019, CUDA > 10.0, +cuDNN > 7.0, OpenCV > 2.4, then to compile Darknet it is recommended to use +[CMake-GUI](#how-to-compile-on-windows-using-cmake-gui). Otherwise, follow these steps: @@ -216,19 +235,6 @@ PS Code\vcpkg> .\vcpkg install pthreads opencv[ffmpeg] #replace with ope 9. Open Powershell, go to the `darknet` folder and build with the command `.\build.ps1`. If you want to use Visual Studio, you will find two custom solutions created for you by CMake after the build, one in `build_win_debug` and the other in `build_win_release`, containing all the appropriate config flags for your system. -### How to compile on Windows (using `Cmake-GUI`) - -Using `Cmake-GUI` as shown here on this [**IMAGE**](https://user-images.githubusercontent.com/4096485/55107892-6becf380-50e3-11e9-9a0a-556a943c429a.png): - -1. Configure -2. Optional platform for generator (Set: x64) -3. Finish -4. Generate -5. Open Project -6. x64 & Release -7. Build -8. Build solution - ### 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.0\opencv\build\include` & `C:\opencv_3.0\opencv\build\x64\vc14\lib`), then open `build\darknet\darknet.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.jpg