Merge pull request #3375 from acxz/build_instructions

Build instructions
This commit is contained in:
Alexey 2019-10-19 15:05:20 +03:00 committed by GitHub
commit 5dfbbfdb5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 49 additions and 9 deletions

View File

@ -19,8 +19,11 @@ 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 CMake-GUI](#how-to-compile-on-windows-using-cmake-gui)
* [Using vcpkg](#how-to-compile-on-windows-using-vcpkg)
* [Legacy way](#how-to-compile-on-windows-legacy-way)
4. [How to train (Pascal VOC Data)](#how-to-train-pascal-voc-data)
@ -51,10 +54,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:
@ -171,7 +170,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.
Do 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)
@ -189,9 +204,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:
@ -615,8 +649,14 @@ 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
* using `build.sh` or
* build `darknet` using `cmake` or
* set `LIBSO=1` in the `Makefile` and do `make`
* on Windows
* 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