GithubHelp home page GithubHelp logo

go-darknet's Introduction

go-darknet: Go bindings for Darknet

GoDoc

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:

#ifndef DARKNET_API
#define DARKNET_API
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>

#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

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:

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.

go-darknet's People

Contributors

deepch avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

go-darknet's Issues

How to draw rectangle on go stream?

I'm trying to draw a rectangle on the []uint8 stream.
the goal is when I'm using the RTSPtoWSMP4f I can draw a bounding box prediction of ML models on the video in the client.

in short:
[]uint8 + rectangle => videoTagHtml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.