tfjs-yolo
YOLO
object detection with Tensorflow.js. Supports YOLO v3 and Tiny YOLO v1, v2, v3.
Demo
-
Detect objects using your webcam: https://shaqian.github.io/tfjs-yolo-demo/
-
Not hotdog PWA: https://shaqian.github.io/Not-Hotdog/
Install
npm install tfjs-yolo
Usage
Import module
;
Initialize and load model
// Use default models (stored in my GitHub demo repo)let myYolo = await yolo;let myYolo = await yolo;let myYolo = await yolo;let myYolo = await yolo; // or specify path or handler, see https://js.tensorflow.org/api/0.13.3/#loadModellet myYolo = await yolo; // or use frozen model, see https://js.tensorflow.org/api/0.13.3/#loadFrozenModellet myYolo = await yolo;
Run model
Supported input html element:
- img
- canvas
- video
const boxes = await myYolo; // Optional settingsconst boxes = await myYolo;
Output box format
top // Float left // Float bottom // Float right // Float height // Float width // Float score // Float class // String, e.g. person
Dispose model
myYolo;