This commit is contained in:
Dimitrii
2022-02-04 23:21:57 +03:00
parent 020dc47d85
commit 7edf795470
11 changed files with 17 additions and 18 deletions

13
.gitignore vendored
View File

@@ -1,9 +1,10 @@
example/main
example/coco.names
example/yolov3.cfg
example/yolov3.weights
example/yolov4.cfg
example/yolov4.weights
cmd/examples/main
cmd/examples/base_example/main
cmd/examples/coco.names
cmd/examples/yolov3.cfg
cmd/examples/yolov3.weights
cmd/examples/yolov4.cfg
cmd/examples/yolov4.weights
darknet.h
*.so
predictions.png

View File

@@ -64,13 +64,13 @@ go get github.com/LdDl/go-darknet
## Usage
Example Go program is provided in the [example] directory. Please refer to the code on how to use this Go package.
Example Go program is provided in the [examples] directory. Please refer to the code on how to use this Go package.
Building and running program:
* Navigate to [example] folder
* Navigate to [examples] folder
```shell
cd $GOPATH/github.com/LdDl/go-darknet/example/base_example
cd ${YOUR PATH}/github.com/LdDl/go-darknet/cmd/examples
```
* Download dataset (sample of image, coco.names, yolov4.cfg (or v3), yolov4.weights(or v3)).
@@ -106,10 +106,10 @@ Building and running program:
It will reduce amount of VRAM used for detector test.
* Build and run program
* Build and run example program
Yolo V4:
```shell
go build main.go && ./main --configFile=yolov4.cfg --weightsFile=yolov4.weights --imageFile=sample.jpg
go build -o base_example/main base_example/main.go && ./base_example/main --configFile=yolov4.cfg --weightsFile=yolov4.weights --imageFile=sample.jpg
```
Output should be something like this:
@@ -165,5 +165,5 @@ go-darknet follows [Darknet]'s [license].
[darknet.h]: https://github.com/AlexeyAB/darknet/blob/master/include/darknet.h
[include/darknet.h]: https://github.com/AlexeyAB/darknet/blob/master/include/darknet.h
[Makefile]: https://github.com/alexeyab/darknet/blob/master/Makefile
[example]: /example/base_example
[examples]: cmd/examples/base_example
[GoDoc]: https://godoc.org/github.com/LdDl/go-darknet

View File

@@ -4,12 +4,13 @@ import (
"bytes"
"flag"
"fmt"
darknet "go-darknet"
"image"
"image/jpeg"
"log"
"math"
"os"
darknet "github.com/LdDl/go-darknet"
"github.com/disintegration/imaging"
)
@@ -60,7 +61,7 @@ func main() {
if err != nil {
panic(err.Error())
}
dr, err := n.Detect(imgDarknet)
if err != nil {
printError(err)

View File

@@ -11,7 +11,7 @@ import (
"log"
"net/http"
"github.com/LdDl/go-darknet"
"go-darknet"
)
var configFile = flag.String("configFile", "",

View File

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 134 KiB

1
go.mod
View File

@@ -3,7 +3,6 @@ module go-darknet
go 1.17
require (
github.com/LdDl/go-darknet v1.3.5
github.com/disintegration/imaging v1.6.2
golang.org/x/image v0.0.0-20211028202545-6944b10bf410
)

2
go.sum
View File

@@ -1,5 +1,3 @@
github.com/LdDl/go-darknet v1.3.5 h1:oOMpWesW0+8ZLOdZcGS4LfjKKS48cHUceNrBy1MU7aM=
github.com/LdDl/go-darknet v1.3.5/go.mod h1:vNpwlxHd2mevaqWDYG9r/ABi1+cQrXw0HUuSPaDKuD8=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=