Video Analytics in 2 Lines of Code

Amruta
1 min readMar 22, 2020

--

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..

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Amruta
Amruta

Written by Amruta

Creative Media Technology || Website: pamruta.com

No responses yet

Write a response