What is Machine Learning?
Machine learning is an area of artificial intelligence that can freely be defined as the study of programs and algorithms that allow computers to perform tasks without special instructions.
What is TensorFlow.js?
The model running in the browser means that from the user's perspective, there is no need to install additional libraries or drivers. Just open the website and the program is ready to run.
Where can it be used?
- On the server side or even in IoT devices such as the Raspberry Pi using Node.js
- In desktop applications using Electron
- In native mobile applications using React Native.
Benefits of Client-Side Execution
We can train the model in the user's web browser without sending data to the web server. This can sometimes be a condition for compliance with local laws, such as GDPR.
Since we do not have to send data to the server, inference (the act of classifying data) can be faster. In addition, we have direct access to device sensors such as camera, microphone, GPS, accelerometer and more if the user grants us access.
Anyone can open the web page in their browser with one click and use what we have created.
No server means that the only thing we must pay for is a CDN to host our HTML, CSS, JS files. The cost of a CDN is much lower than renting and maintaining a server.
Benefits of Server-Side Execution
We may sometimes work with very large models. Such models cannot run in a web browser due to memory limitations per browser tab. To be able to run such models we can use our own server with Node.js installed.
Node.js is supported on IoT devices such as the Raspberry Pi, which in turn means we can run TensorFlow.js models on such devices, as well.
Want to Learn More?
You can learn more about the TensorFlow.js library by following the links below.
TensorFlow.js - Tutorials
GitHub - TensorFlow Examples
In the following article I’ll tell you more about the architecture of this library, and a practical example (using an IoT device to identify a free parking space) will allow you to get to know it better.