Main crate: darknet
darknet-sys: FFI bindings to AlexeyAB's Darknet
Usage
Get the crate by adding the dependency to your Cargo.toml.
= "0.3"
If you clone the repository manually, run git submodule init && git submodule update --recursive to get all submodules.
Cargo Features
enable-cuda: Enable CUDA (expects CUDA 10.x and cuDNN 7.x).enable-cudnn: Enable cuDNNenable-opencv: Enable OpenCV.runtime: Link to darknet dynamic library. For example,libdark.soon Linux.dylib: Build dynamic library instead of staticbuildtime-bindgen: Generate bindings from darknet headers.
Build
By default, darknet-sys compiles and link to darknet statically. You can control the feature flags to change the behavior.
Method 1: Download and build from source (default)
By default, it builds and links to darknet statically.
You can optionally enable CUDA and OpenCV features. Please read Build with CUDA section to work to CUDA properly.
Method 2: Build with custom source
If you prefer to build with your darknet source, fill the source directory to the DARKNET_SRC environment variable. It expects a CMakeLists.txt in that directory.
Method 3: Link to darknet dynamic library
With runtime feature, darknet-sys will not compile the darknet source code and instead links to darknet dynamically. If you are using Linux, make sure libdark.so is installed on your system.
Re-generate bindings
With buildtime-bindgen feature, darknet-sys re-generates bindings from headers. It guesses the header file paths according to feature flags. The option is necessary only when darkent is updated or modified.
If you prefer to your (possibly modified) header files, fill the header directory to DARKNET_INCLUDE_PATH environment variable.
Build with CUDA
Please check both CUDA 10.x and cuDNN 7.x are installed and versions are correct.
They are not installed to standard paths on most systems. Please add the CUDA library directory to LIBRARY_PATH environment variable before building. For example on Ubuntu and CUDA 10.1,
License
MIT license.
Credits
Huge thanks to jerry73204