In this article, I show you how to perform image recognition & video understanding tasks in just 2 lines of code, using TensorFlow.JS
To detect objects :
model = cocoSsd.load();
objects = model.detect(frame);
Model output tested on Olympics horse-riding game..
For video tagging :
model = mobilenet.load();
tags = model.classify(frame);
Model output tested on wild-life documentary films..
To capture Facial Expressions :
model = facemesh.load();
faces = model.estimateFaces(frame);
Model output tested on live video stream to detect facial expressions..
For Hand-Tracking :
model = handpose.load();
result = model.estimateHands(frame);
Model tested on live camera stream to generate music using hand gestures..
Or to move objects in AR / VR..
For body segmentation :
model = bodyPix.load();
pixel_array = model.segmentPersonParts(frame);
Model output tested on live camera stream..
And to create chroma-key effect by replacing background..
Yes, that’s how easy it is to use TensorFlow.JS
See code samples at : https://github.com/pamruta/TensorFlowJS
The rest of the Java Script just loads the video in HTML, scans it frame by frame and displays the output on screen..