JavaScript in Machine Learning Models

NARMADA M
3 min readJun 25, 2021

There is a Library in javascript which is used for training and deploying machine learning models in the browser and in Node.js — — TensorFlow.js

If we wanna start with Machine Learning, but not to worry about the Tensors or Optimizers.
ml5.js library which built on the top of Tensor flow.js provides access to ML algorithms and models in the browser with concise.

TensorFlow.js provides flexible building blocks for neural network programming in JavaScript.

There are two main ways to get TensorFlow.js in your browser based projects:
→Using script tags.

→Installation from NPM and using a build tool like Parcel, WebPack, or Rollup.

We can also convert pretrained models from Python into TensorFlow.js

Terminology used in TensorFLow.js
ES Modules — The standard JavaScript module system. Introduced in ES6/ES2015. Identifiable by use of import and export statements.

Bundling — Taking a set of JavaScript assets and grouping/bundling them into one or more JavaScript assets that are usable in a browser. This is the step that usually produces the final assets that are served to the browser. Applications will generally do their own bundling directly from transpiled library sources. Common bundlers include rollup and webpack. The end result of bundling is a known as a bundle (or sometimes as a chunk if it is split into multiple parts)

Tree-Shaking / Dead Code Elimination — Removal of code that is not used by the final written application. This is done during bundling, typically in the minification step.

Operations (Ops) — A mathematical operation on one or more tensors that produces one or more tensors as output. Ops are ‘high level’ code and can use other ops to define their logic.

Kernel — A specific implementation of an op tied to specific hardware capabilities. Kernels are ‘low level’ and backend specific. Some ops have a one-to-one mapping from op to kernel while other ops use multiple kernels.

MODELS

IMAGE CLASSIFICATION

Classify images with labels from the ImageNet

OBJECT DETECTION

Localize and identify multiple objects in a single image(Coco SSD)

BODY SEGMENTATION

Segment person(s) and body parts in real-time(BodyPix)

POSE ESTIMATION

Estimate human poses in real-time(PoseNet)

TEXT TOXICITY DETECTION

Score the perceived impact a comment may have on a conversation, from “Very toxic” to “Very healthy”(Toxicity).

HAND POSE DETECTION

Palm detector and hand-skeleton finger tracking model.Predict 21 3D hand keypoints per detected hand

NATURAL LANGUAGE QUESTION ANSWERING

Answer questions based on the content of a given passage of text using BERT

SPEECH COMMAND RECOGNITION

Classify 1-second audio snippets from the speech commands dataset(speech-commands).

KNN CLASSIFIER

Utility to create a classifier using the K-Nearest Neighbors algorithm. Can be used for transfer learning.

SIMPLE FACE DETECTION

Detect faces in images using a Single Shot Detector architecture with a custom encoder(Blazeface).

#worldrecordholder #training #internship #makingindiafutureready #summer #summertraining

#python #javascript #docker #rightmentor #deepknowledge #linuxworld #vimaldaga #righteducation

--

--