Tiny YOLO
object detection with the latest version (v1.0.0) of Tensorflow.js.
npm install tfjs-tiny-yolov3
import TinyYoloV3 from 'tfjs-tiny-yolov3';
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")
@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);
const boxes = await model.detectAndBox(image, flipHorizontal);
{
top, // Float
left, // Float
bottom, // Float
right, // Float
height, // Float
width, // Float
score, // Float
class // String, e.g. person
}