Skip to content

Latest commit

 

History

History
86 lines (62 loc) · 1.4 KB

README.md

File metadata and controls

86 lines (62 loc) · 1.4 KB

Tiny-YOLOv3 using TensorFlow.js

Tiny YOLO object detection with the latest version (v1.0.0) of Tensorflow.js.

Install

npm install tfjs-tiny-yolov3

Usage

Import module

import TinyYoloV3 from 'tfjs-tiny-yolov3';

Initialize and load model

const model = new TinyYoloV3();

//Optional settings
const model = new TinyYoloV3({
	nObject = 20, 
	scoreTh = .2,  
	iouTh = .3
});

// Use default models
await model.load()


// or specify path 
await model.load("https://.../model.json")

Run model

Get Output Feature Only

@param image
	Supported input html element:
	- img
	- canvas
	- video
@param flipHorizontal = true
	flip the image if input source is webcam
const features = await model.predict(image, flipHorizontal);

Detect Object and Box

const boxes = await model.detectAndBox(image, flipHorizontal);

Output box format

{
  top,    // Float
  left,   // Float
  bottom, // Float
  right,  // Float
  height, // Float
  width,  // Float
  score,  // Float
  class   // String, e.g. person
}

Credits