# yolov5

> YOLO v5 small

Latest version **1.0.11** (published 2022-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install yolov5
pnpm add yolov5
yarn add yolov5
bun add yolov5
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2022-01-21 |
| First published | 2022-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 27.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Subhranil Majumder |
| Maintainers | smajum |
| Keywords | yolo, yolo v5, yolov5, object_detection, tensorflow |

## Links

- npm: https://www.npmjs.com/package/yolov5
- Repository: https://github.com/sbhmajum369/model-hub-JS/blob/main/packages/YOLO/README.md
- npm.io page: https://npm.io/package/yolov5

## Dependencies (2)

- [@tensorflow/tfjs](https://npm.io/package/@tensorflow/tfjs.md) ^3.13.0
- [@tensorflow/tfjs-node](https://npm.io/package/@tensorflow/tfjs-node.md) ^3.13.0

## Recent versions

- 1.0.11 (latest) — 2022-01-21
- 1.0.10 — 2022-01-21
- 1.0.9 — 2022-01-21
- 1.0.8 — 2022-01-17
- 1.0.7 — 2022-01-17
- 1.0.6 — 2022-01-17
- 1.0.5 — 2022-01-16
- 1.0.4 — 2022-01-16
- 1.0.3 — 2022-01-16
- 1.0.2 — 2022-01-16
- 1.0.1 — 2022-01-16
- 1.0.0 — 2022-01-16
- 0.3.0 — 2022-01-16
- 0.2.0 — 2022-01-16
- 0.1.0 — 2022-01-14

## README

# 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  

```javascript

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: 
```javascript
{
	"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.

---
_Source: https://npm.io/package/yolov5 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
