Skip to content

Commit

Permalink
0.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Apr 10, 2017
2 parents 407a810 + 66a8c67 commit 70ee2c6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 19 deletions.
10 changes: 6 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
node_modules
build/
.DS_Store
test/yolo.weights
test/data.modified.raw
test/data.raw
npm-debug.log
*.ffm
test/detected.mp4
yolo.weights
test/yolo.weights
data
cfg
*.jpeg
test/server.conf
tiny-yolo-voc.weights
data.raw
*.mp4
*.ffm
test/data
test/cfg
*.ffm
test/detected.mp4
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Darknet is [an open source neural network framework written in C and CUDA](https://github.com/pjreddie/darknet).
This project wraps this framework in a Node.js native addon.

<img src="https://lab.moovel.com/content/uploads/yolo-micro-prv.gif" width="458px" height="258px">

- [darknet](http://pjreddie.com/darknet/)
- [YOLO (You only look once)](http://pjreddie.com/darknet/yolo/)

Expand All @@ -20,7 +22,7 @@ Currently, the wrapper implements a demo method to run a recognition from the we
This module requires OpenCV installed. First, you need to compile [this fork](https://github.com/OrKoN/darknet) of darknet with OpenCV support (optionally, with CUDA support):

```sh
git clone git@github.com:OrKoN/darknet.git
git clone https://github.com/OrKoN/darknet
cd darknet
make OPENCV=1 # optionally GPU=1
make install # by default installed to /usr/local
Expand All @@ -42,7 +44,7 @@ npm install @moovel/yolo --save

## Usage

Either download you own `cfg`, `data` folders and `.weight` files from the darknet project or use the ones included in `test` folder (see also [test/readme.md](test/readme.md)). You also can find there the examples from below.
Either download your own `cfg`, `data` folders and `.weight` files from the darknet project or use the ones included in `test` folder (see also [test/readme.md](test/README.md)). You also can find there the examples from below.

Detect a video from camera or a file:

Expand All @@ -55,14 +57,15 @@ darknet.detect({
data: './cfg/coco.data',
cameraIndex: 0, // optional, default: 0,
video: "./test.mp4", // optional, forces to use the video file instead of a camera
thresh: 0.24,
hierThresh: 0.5,
}, function(modified, original, detections) {
thresh: 0.24, // optional, default: 0.24
hierThresh: 0.5, // optional, default: 0.5
}, function(modified, original, detections, dimensions) {
/**
modified - raw frame with detections drawn, rgb24 format
original - raw frame, as captured by the webcam/video, rgb24 format,
detections - array of detections
dimenstions - image width and height
Example detections:
Expand Down Expand Up @@ -108,15 +111,15 @@ darknet.detectImage({
weights: './yolo.weights',
data: './cfg/coco.data',
image: './data/dog.jpg',
thresh: 0.24,
hierThresh: 0.5,
thresh: 0.24, // optional, default: 0.24
hierThresh: 0.5, // optional, default: 0.5,
}, function(modified, original, detections, dimensions) {
/**
modified - raw frame with detections drawn, rgb24 format
original - raw frame, as captured by the webcam/video, rgb24 format,
detections - array of detections
dimenstions - image dimensions
dimenstions - image width and height
Example detections:
Expand Down
2 changes: 0 additions & 2 deletions darknet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class VideoDetectionWorker : public AsyncProgressWorkerBase<T> {
obj->Set(Nan::New("prob").ToLocalChecked(), Nan::New<v8::Number>(result.prob));
obj->Set(Nan::New("name").ToLocalChecked(), Nan::New<v8::String>(result.name).ToLocalChecked());
results->Set(i, obj);
i++;
}

v8::Local<v8::Object> dimensions = Nan::New<v8::Object>();
Expand Down Expand Up @@ -84,7 +83,6 @@ class ImageDetectionWorker : public AsyncWorker {
obj->Set(Nan::New("prob").ToLocalChecked(), Nan::New<v8::Number>(result.prob));
obj->Set(Nan::New("name").ToLocalChecked(), Nan::New<v8::String>(result.name).ToLocalChecked());
results->Set(i, obj);
i++;
}

v8::Local<v8::Object> dimensions = Nan::New<v8::Object>();
Expand Down
23 changes: 18 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
{
"name": "@moovel/yolo",
"version": "0.1.2",
"version": "0.1.9",
"description": "NodeJS interface for YOLO/Darknet",
"keywords": [
"yolo",
"darknet",
"recognition"
],
"homepage": "https://github.com/moovel/node-yolo",
"bugs": {
"url": "https://github.com/moovel/node-yolo/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/moovel/node-yolo.git"
},
"main": "darknet.js",
"gypfile": true,
"dependencies": {
"bindings": "~1.2.1",
"nan": "^2.0.0"
},
"devDependencies": {
"fluent-ffmpeg": "^2.1.0"
},
"license": "MIT"
"license": "MIT",
"engines": {
"node": ">=4"
}
}
1 change: 1 addition & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
You already have the config and data file for YOLO in the `test/cfg` and `test/data` subfolders. You will have to download the pre-trained weight file [here (258 MB)](http://pjreddie.com/media/files/yolo.weights). Or just run this:

```sh
cd node-yolo/test
wget http://pjreddie.com/media/files/yolo.weights
```

Expand Down

0 comments on commit 70ee2c6

Please sign in to comment.