diff --git a/.gitignore b/.gitignore index 831d605..4934200 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md index 0ca1eb3..c8c59d9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/example/base_example/README.md b/cmd/examples/base_example/README.md similarity index 100% rename from example/base_example/README.md rename to cmd/examples/base_example/README.md diff --git a/example/base_example/main.go b/cmd/examples/base_example/main.go similarity index 98% rename from example/base_example/main.go rename to cmd/examples/base_example/main.go index 8738bc3..c89b210 100644 --- a/example/base_example/main.go +++ b/cmd/examples/base_example/main.go @@ -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) diff --git a/example/download_data.sh b/cmd/examples/download_data.sh similarity index 100% rename from example/download_data.sh rename to cmd/examples/download_data.sh diff --git a/example/download_data_v3.sh b/cmd/examples/download_data_v3.sh similarity index 100% rename from example/download_data_v3.sh rename to cmd/examples/download_data_v3.sh diff --git a/example/rest_example/README.md b/cmd/examples/rest_example/README.md similarity index 100% rename from example/rest_example/README.md rename to cmd/examples/rest_example/README.md diff --git a/example/rest_example/main.go b/cmd/examples/rest_example/main.go similarity index 99% rename from example/rest_example/main.go rename to cmd/examples/rest_example/main.go index 69129d5..9c2ba39 100644 --- a/example/rest_example/main.go +++ b/cmd/examples/rest_example/main.go @@ -11,7 +11,7 @@ import ( "log" "net/http" - "github.com/LdDl/go-darknet" + "go-darknet" ) var configFile = flag.String("configFile", "", diff --git a/example/sample.jpg b/cmd/examples/sample.jpg similarity index 100% rename from example/sample.jpg rename to cmd/examples/sample.jpg diff --git a/go.mod b/go.mod index e83392a..11ab3be 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index 573b558..6abdd3e 100644 --- a/go.sum +++ b/go.sum @@ -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=