JSPM

  • Created
  • Published
  • Downloads 67
  • Score
    100M100P100Q65601F
  • License MIT

Package Exports

  • darknet

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (darknet) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Darknet.JS

Just when you thought the world was beautiful, I put YOLO into JavaScript.

Installation

To install, first clone your favourite blend of the pjreddie's darknet repository, and build it. Once it's built, there should be a file called libdarknet in the root directory. This is the file that darknet.js needs to work.

If you've built darknet, you can go ahead and install darknet.js by running:

npm install darknet

Usage

To create an instance of darknet.js, you need a four things. The trained weights, the configuration file they were trained with, a list of the names of all the objects (in order), and the libdarknet.so file.

Example

import { Darknet } from 'darknet';

// Init
let darknet = new Darknet({
    weights: './cats.weights',
    config: './cats.cfg',
    names: [ 'dog', 'cat' ]
    library: './libdarknet'
});

// Detect
console.log(darknet.detect('/image/of/a/dog/.jpg'));

Async

By default, darknet.js will run the detections synchronously. If this isn't your style, you can run detections asynchronously, using the detectAsync method.

darknet.detectAsync('/image/of/a/dog/.jpg')
    .then(detections => console.log(detections));

Unfortunately only Promises are supported at this time, but support for callbacks will be coming soon.

Built-With