This is the 17th day of my participation in Gwen Challenge
Tensorflow.js is a JavaScript library for training and deploying machine learning models in browsers and Node.js
Easy to write machine learning applications
It’s fun to try machine learning, even if we don’t understand the details of machine learning such as tensors or optimizers. Ml5.js makes it easy to write machine learning applications by building on tensorflow.js. Ml5.js makes it easy to use machine learning algorithms and models in the browser with its concise, easy-to-understand API.
If you are familiar with tensors, layers, optimizers, loss functions, etc., and want to develop more personalized, custom models, tensorflow.js provides support for those of you familiar with JavaScript.
Easy to use Python models
- Existing trained models can be transformed into models that can be used by the Web front end, but only Google’s own Keras and TensorFlow should be supported
Rich examples
Tfjs-examples provides small code examples that use tensorflow.js to implement various ML tasks.
visualization
Tfjs-vis is a small library for visualization in browsers that needs to be used in conjunction with tensorflow.js.
Install tensorflow.js on the browser side and server side
Browser Installation
There are two ways to use tensorflow.js on the browser side
- Import tensorflow.js with script tags
- You can also install NPM or create tensorflow.js projects using build tools such as Parcel, WebPack, or Rollup
If you’re new to Web development or have never heard of tools like Webpack or Parcel, it’s recommended that you use the script tag approach to introduce tensorflow.js. If these tools are familiar to you, you are advised to use build tools.
Tensorflow.js is installed with tag introduction
Use the following tags to import tensorflow.js
< script SRC = "https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js" > < / script >Copy the code
Install tensorflow.js as a build tool
yarn add @tensorflow/tfjs
Copy the code
npm install @tensorflow/tfjs
Copy the code
Nodejs installation
Tensorflow.js can be installed using NPM or YARN
- The first option is to install tensorflow.js with a c++ binding
yarn add @tensorflow/tfjs-node
Copy the code
npm install @tensorflow/tfjs-node
Copy the code
- If an NVIDIA® GPU has been installed on the system (applicable only to Linux), you can install the GPU-supported Tensorflow. js
yarn add @tensorflow/tfjs-node-gpu
Copy the code
npm install @tensorflow/tfjs-node-gpu
Copy the code
- Of course, you can also install the javascript version directly, this version is less performance than the above two versions
yarn add @tensorflow/tfjs
Copy the code
npm install @tensorflow/tfjs
Copy the code