1.0.11 • Published 2 years ago

yolov5 v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

YOLO v5 in Node.JS

Object Detection using YOLO for Node.js backend.

ES6 compatibile

Installation

npm i yolov5

It also installs the required dependencies: tfjs, tfjs-node and regenerator-runtime

For more info on tensorflow backend in node.js:
(https://github.com/tensorflow/tfjs/tree/master/tfjs-node) (https://github.com/tensorflow/tfjs)

Usage

require('regenerator-runtime');
const yolov5 =  require('yolov5');
// import {YOLOv5s} from 'yolov5';


const main = async() => {	
	let predictions;

	const yolo = yolov5;		// Create an instance of the model 
	await yolo.load();			// Load Model 

	if (yolo.model != '') {
		console.log("Model loaded \n");
		const result = await yolo.predict(image);		// Input image must be in 640x640 format 
		predictions = yolo.getDetections(result);		// Get bounding box(s) and class data 
	} else {
		return console.error("Model not found \n");
	}

	if (predictions.length > 0) console.log("Predictions:", predictions);
	
	yolo.dispose;
};

main();

View model parameters, methods, functions: console.log(yolo.details())

Output

Prediction format:

{
	"bbox": [409, 1, 639, 169],		// [x0, y0, x1, y1]
	"score": 0.6489,				// probability score
	"class": "car"					// Object class name
}

Notes

  • Current backend support only for CPU via tfjs-node.

  • Insert regenerator-runtime or its equivalent for async-await based functional implementation.

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago