This might also be interesting for you: How to enable GPU for TensorFlow in Windows
Language and environment
Tensorflow Python provides a comprehensive Python library for machine learning. Python is a widely used programming language in the field of machine learning and offers a variety of libraries and frameworks to facilitate model development and deployment.
One of the greatest strengths of Tensorflow.js is the ability to run models directly in the browser. This allows developers to create interactive web applications with machine learning without the user having to install additional software or send external server requests.
Tensorflow Python, on the other hand, allows models to be developed and run on multiple platforms, including desktop computers, servers and mobile devices. It offers a wide range of features and supports advanced techniques such as training models on GPUs or TPUs. TPU stands for “Tensor Processing Unit”. These are application-specific chips to accelerate machine learning applications.
Tensorflow Python, on the other hand, benefits from a large and active community that regularly develops and publishes new models, techniques and resources. There are a variety of tutorials, forums and open source projects that can help you advance your machine learning projects. The Python community is known for its support and collaboration, which can make it easier to get started with Tensorflow Python.
In many cases, and specifically for my NLP project, a knockout criterion for Tensorflow.js was the libraries. Tensorflow.js has far less libraries compared to Tensorflow Python. In my view, this is due to the following 3 points:
- Development status: Tensorflow Python exists for several years and has had a long development period. During this time, numerous extensions, modules and additional libraries have been developed specifically for Tensorflow Python. Tensorflow.js, on the other hand, is a comparatively newer technology and may still be in an earlier stage of development. Therefore, Tensorflow.js may have fewer libraries and extensions developed specifically for this platform.
- Target platform: Tensorflow Python targets a wide range of platforms, including desktop computers, servers and mobile devices. As a result, there are a variety of specialised libraries and extensions for different use cases and hardware configurations. Tensorflow.js, on the other hand, aims to run models directly in the browser. Therefore, the functions and libraries of Tensorflow.js are optimised for the requirements of web applications and the limited resource availability in the browser.
However, it is important to note that Tensorflow.js is constantly evolving and the library and available extensions may grow over time. The community around Tensorflow.js is working to expand the ecosystem and provide new libraries as well as tools to improve the functionality and expand the possibilities of Tensorflow.js.
Written in C++, TensorFlow is a cross-platform library supported on various operating systems including Windows, macOS and Linux. It can be used to develop and run models on servers as well as desktop computers.
Training large models
Why TensorFlow.js in the browser?
There is the issue of speed. Since you don’t have to send data to a remote server, classification is faster. In addition, you have direct access to sensors such as camera, microphone, GPS, etc.
In addition, data protection is an important issue in many countries. You can train and classify data on your own computer without having to send it to an external web server. This may be necessary to comply with data protection laws such as the DSGVO or if one does not want to share the data with third parties.
With one click, anyone in the world can access and use the application via a link without the need for a complex setup with servers and special hardware such as graphics cards.
Finally, with ML you should also keep an eye on the costs. You only have to pay for hosting the client. This is much cheaper than maintaining your own server permanently.
Conclusion: Tensorflow.js vs. Tensorflow?
Overall, the question Tensorflow.js vs. Tensorflow can be answered in a simplified way by saying that Tensorflow with Python is almost ALWAYS the better choice due to its broad acceptance and large community. Nevertheless, Tensorflow.js is becoming increasingly important and is predominantly used by developers who want to develop web applications with machine learning on the client side.
This means if you want to build apps that run in the web browser, TensorFlow.js is actually the better choice. However, if you want to build apps to run on a server or desktop computer, TensorFlow is the better option. Also, the Python version is much better suited if you want to work with powerful devices like GPUs.