TensorFlow.js is another exhilarating achievement by Google after the launch of TensorFlow framework in 2015. By introducing the all new TensorFlow.js, it has been proven yet again that we are witnessing an awesome transformations happening in the field of machine learning. TensorFlow.js is one of a kind open source library that can be used by javascript professionals to run and train Machine Learning models by using a browser and also on NodeJS. It uses high level APIs to run models. It is the best way out for developers to use javascript as a language to run Machine Learning models. It is an upgrade to the previously known low level API known as deeplearn.js which was recently renamed as “Tensorflow.js Core”.
Tensorflow.js
TensorFlow has recently introduced a phenomenal library called the tensoflow.js. It uses Tensors as the core data concepts for its implementation. TensorFlow.js can also be used to run existing models available to us, which is fantastic, as a developer may want to use a keras/tensorflow model that may have been trained offline. With this launch by google, the TensorFlow.js has become to most popular library available today.
For the best usage, the recently released NodeJS bindings for TensorFlow has been very benefitial. As it allows us to work on both NodeJS and Browser. A very useful advantage of using this is that the mobile sensors can even provide sensor data to the model. Another advantage is that it supports GPU acceleration. We can also retain the existing machine learning models using data connected to the browser or the other side of the client.
Using TensorFlow.js in your project:
The best and the easiest way of using the TensorFlow.js is to add the code in the bold inside the script tags as shown:
<head>
<script src=”https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.12.0″> </script>
</head>
Also,
The main code for cleaning, testing, predicting and running the machine learning model is written between the script tags. For example:
<script>
(x_train,y_train),(x_test,y_test)=mnist.load_data()
.
.
. #tensorflow code body
.
.
y=tf.matmul(x,w)+b
</script>
So, Finally
TensorFlow.js is a library like no other for machine learning development in javascript that plays an important role in machine learning. Now we are able to train models in a browser, which seems to be a great achievement. Being an machine learning developer myself, I am certain that this will change the way we train and run ML models.
*Also follow up this link to check tutorials and docs for tensorflow.js: https://js.tensorflow.org/
*Also check out GitHub for examples.
Share Your Views: