This repository provides a plug and play implementation of the Yolo V3 object detection system in Go, leveraging gocv.
Since this implementation builds on top of the gocv library, make sure you either use one of the provided docker images to run the example, or install the opencv dependencies on your system.
Furthermore, make sure you've got the yolov3 models downloaded before running the examples.
Simply run $ make models
$ make bird-example
Output
$ make street-example
Output
$ make webcam-example
Note that this will not run smoothly on most machines, as the default net target type is set to NetTargetCPU
. If you have cuda installed, adjust the net initialization to:
conf := yolov3.DefaultConfig()
// Adjust the backend and target type
conf.NetBackendType = gocv.NetBackendCUDA
conf.NetTargetType = gocv.NetTargetCUDA
// Create the net with created config
yolonet, err := yolov3.NewNetWithConfig(yolov3WeightsPath, yolov3ConfigPath, cocoNames, conf)
if err != nil {
log.WithError(err).Fatal("unable to create yolo net")
}
Execute 50 fps test render with cuda, also see the CUDA section.
$ make cuda-example
If you're interested in running yolo in Go with CUDA support, check the cmd/example_cuda
to see a dummy example and test results of running object detection at 50 fps. The gocv cuda README provides detailed installation instructions.
If you have any issues, feel free to open a PR or create an issue!