https://github.com/deepch/go-darknet
https://github.com/deepch/go-darknet
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/deepch/go-darknet
- Owner: deepch
- Created: 2021-05-14T22:20:07.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T08:50:21.000Z (over 2 years ago)
- Last Synced: 2025-03-02T18:35:16.846Z (over 1 year ago)
- Language: Go
- Size: 10.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-darknet: Go bindings for Darknet
[](https://godoc.org/github.com/gyonluks/go-darknet)
go-darknet is a Go package, which uses Cgo to enable Go applications to use
YOLO in [Darknet].
## License
go-darknet follows [Darknet]'s [license].
## Requirements
In order to use go-darknet, `libdarknet.so` should be available in one of
the following locations:
* /usr/lib
* /usr/local/lib
The shared library `libdarknet.so` can be obtained after invoking `make` on
[Darknet]'s codebase.
Also, [darknet.h] should be available in one of the following locations:
* /usr/include
* /usr/local/include
The include file [darknet.h] can be obtained from the `include` directory in
[Darknet]'s codebase. However, some modifications will have to be made.
### Modifying darknet.h for install
Make a copy of [include/darknet.h] and put in the same directory as
`libdarknet.so`.
In Darknet's [Makefile], at the top, there are macros which look like the
following:
```
GPU=0
CUDNN=0
OPENCV=0
OPENMP=0
DEBUG=0
```
If any of the above has the value `1`, they will need to be defined in
[darknet.h].
Do not define the ones with value `0` in [darknet.h]!
For example, if `GPU=1` and `CUDNN=1`, they will need to be defined in
[darknet.h] as follows:
```C
#ifndef DARKNET_API
#define DARKNET_API
#include
#include
#include
#include
#define GPU 1
#define CUDNN 1
#define SECRET_NUM -1234
extern int gpu_index;
// The rest of darknet.h's code...
```
Note the lines `#include GPU 1` and `#include CUDNN 1`. They are added just
after the C standard library's `#include` directives.
It is important to replicate the activated macros (macros with value `1`)
at the top of the [Makefile], with the corresponding `#define` directives
in [darknet.h].
After the changes are made to the copy of [darknet.h], copy it to one of the
locations mentioned above.
## Install
```shell
go get github.com/gyonluks/go-darknet
```
The package name is `darknet`.
## Use
Example Go code/program is provided in the [example] directory. Please
refer to the code on how to use this Go package.
Building and running the example program is easy:
```shell
go install github.com/gyonluks/go-darknet/example
# The executable `example` will be available in your $GOPATH/bin
$GOPATH/bin/example
```
## Documentation
See go-darknet's API documentation at [GoDoc].
[Darknet]: https://github.com/pjreddie/darknet
[license]: https://github.com/pjreddie/darknet/blob/master/LICENSE
[darknet.h]: https://github.com/pjreddie/darknet/blob/master/include/darknet.h
[include/darknet.h]: https://github.com/pjreddie/darknet/blob/master/include/darknet.h
[Makefile]: https://github.com/pjreddie/darknet/blob/master/Makefile
[example]: /example
[GoDoc]: https://godoc.org/github.com/gyonluks/go-darknet