5 Commits

Author SHA1 Message Date
Dimitrii Lopanov
df9804aa69 Merge pull request #9 from LdDl/issue-8
network_predict
2020-08-11 12:11:04 +03:00
Dimitrii
68ad5efb35 network_predict 2020-08-11 12:08:59 +03:00
Dimitrii Lopanov
5e18d06f26 badges 2020-06-25 16:31:13 +03:00
Dimitrii Lopanov
ebf93ddfa6 minor 2020-06-19 10:28:20 +03:00
Dimitrii Lopanov
8bd8488c7f minor 2020-06-18 10:40:02 +03:00
2 changed files with 10 additions and 4 deletions

View File

@@ -1,4 +1,8 @@
[![GoDoc](https://godoc.org/github.com/LdDl/go-darknet?status.svg)](https://godoc.org/github.com/LdDl/go-darknet) [![GoDoc](https://godoc.org/github.com/LdDl/go-darknet?status.svg)](https://godoc.org/github.com/LdDl/go-darknet)
[![Sourcegraph](https://sourcegraph.com/github.com/LdDl/go-darknet/-/badge.svg)](https://sourcegraph.com/github.com/LdDl/go-darknet?badge)
[![Go Report Card](https://goreportcard.com/badge/github.com/LdDl/go-darknet)](https://goreportcard.com/report/github.com/LdDl/go-darknet)
[![GitHub tag](https://img.shields.io/github/tag/LdDl/go-darknet.svg)](https://github.com/LdDl/go-darknet/releases)
# go-darknet: Go bindings for Darknet (Yolo V4, Yolo V3) # go-darknet: Go bindings for Darknet (Yolo V4, Yolo V3)
### go-darknet is a Go package, which uses Cgo to enable Go applications to use YOLO V4/V3 in [Darknet]. ### go-darknet is a Go package, which uses Cgo to enable Go applications to use YOLO V4/V3 in [Darknet].
@@ -19,7 +23,7 @@
## Requirements ## Requirements
For proper codebase please use fork of [darknet](https://github.com/AlexeyAB/darknet). Latest commit I've tested [here](https://github.com/AlexeyAB/darknet/commit/08bc0c9373158da6c42f11b1359ca2c017cef1b5) For proper codebase please use fork of [darknet](https://github.com/AlexeyAB/darknet). Latest commit I've tested [here](https://github.com/AlexeyAB/darknet/commit/9dc897d2c77d5ef43a6b237b717437375765b527)
In order to use go-darknet, `libdarknet.so` should be available in one of In order to use go-darknet, `libdarknet.so` should be available in one of
the following locations: the following locations:
@@ -34,7 +38,9 @@ Also, [darknet.h] should be available in one of the following locations:
To achieve it, after Darknet compilation (via make) execute following command: To achieve it, after Darknet compilation (via make) execute following command:
```shell ```shell
sudo cp libdarknet.so /usr/lib/libdarknet.so && sudo cp include/darknet.h /usr/local/include/darknet.h # Copy *.so to /usr/lib + /usr/include (or /usr/local/lib + /usr/local/include)
sudo cp libdarknet.so /usr/lib/libdarknet.so && sudo cp include/darknet.h /usr/include/darknet.h
# sudo cp libdarknet.so /usr/local/lib/libdarknet.so && sudo cp include/darknet.h /usr/local/include/darknet.h
``` ```
Note: do not forget to set LIBSO=1 in Makefile before executing 'make': Note: do not forget to set LIBSO=1 in Makefile before executing 'make':
```Makefile ```Makefile
@@ -64,7 +70,7 @@ Download dataset (sample of image, coco.names, yolov4.cfg (or v3), yolov4.weight
#for yolo v3 #for yolo v3
./download_data_v3.sh ./download_data_v3.sh
``` ```
Note: you don't need *coco.data* file anymore, because sh-script above does insert *coco.names* into 'names' filed in *yolov4.cfg* file (so AlexeyAB's fork can deal with it properly) Note: you don't need *coco.data* file anymore, because sh-script above does insert *coco.names* into 'names' field in *yolov4.cfg* file (so AlexeyAB's fork can deal with it properly)
So last rows in yolov4.cfg file will look like: So last rows in yolov4.cfg file will look like:
```bash ```bash
...... ......

View File

@@ -14,7 +14,7 @@ struct network_box_result perform_network_detect(network *n, image *img, int cla
sized = resize_image(*img, n->w, n->h); sized = resize_image(*img, n->w, n->h);
} }
struct network_box_result result = { NULL }; struct network_box_result result = { NULL };
network_predict_ptr(n, sized.data); network_predict(*n, sized.data);
int nboxes = 0; int nboxes = 0;
result.detections = get_network_boxes(n, img->w, img->h, thresh, hier_thresh, 0, 1, &result.detections_len, letter_box); result.detections = get_network_boxes(n, img->w, img->h, thresh, hier_thresh, 0, 1, &result.detections_len, letter_box);
if (nms) { if (nms) {