TensorFlow.js
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
1. What is it?
TensorFlow.js is a library for machine learning in JavaScript
Develop ML models in JavaScript, and use ML directly in the browser or in Node.js.
2. How it works?
-
Run existing models
Use off-the-shelf JavaScript models or convert Python TensorFlow models to run in the browser or under Node.js.
-
Retrain existing models
Retrain pre-existing ML models using your own data.
-
Develop ML with JavaScript
Build and train models directly in JavaScript using flexible and intuitive APIs.
3. TensorFlow.js API
- High level Layers API (like Keras)
- Low level Ops API (Mathmetical)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
Notice that backend (CPU, WebGL, WASM) doen't mean server side here, it means the hardware where tensorflow will be executed.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
5. Run existing models
Pre-trained Model
Example 1: Question and Answer Model
NPM Example
Example 2: Object Detection (coco-ssd)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
NPM Example
The predictions format be like
Advance Pre-tranined Model
https://www.kaggle.com/models?tfhub-redirect=true
Structure
- model.json - bunch of metadata about model type, its architecture, and configuration details.
- shardXofN.bin - all of trained parameters that the model has learned in order to perform a certain task.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
Example: MoveNet Singlepose Lightning
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
https://www.kaggle.com/models/google/movenet/tfJs/singlepose-lightning
Offline model
Save to local storage for offline access!
Check for saved models in local storage:
Load just like before but using localstorage url:
6. Retrain existing models
Real project
Teachable Machine
Transfer learning
Transfer learning (TL) is a technique in machine learning (ML) in which knowledge learned from a task is re-used in order to boost performance on a related task.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
Advantages
- Faster to train
- Reuses knowledge learnt from the base model
- Less example data required to classify new examples
- Very well suited for web browser environment
Check tutorial below to understand how teachable machine does trainsfer learning.
7. Tensors
Dimension (Rank)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
|
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
|
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
|
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
|
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
|
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
|
Data Type (DType)

Shape

Size

Memory Management
Check api document for tensor usage.
Example: Normalization

8. Develop ML with JavaScript

Example: Single Neuron Linear Regression Model


Check the simple demo repo here.
9. Refference
- Course
- TensorFlow.js
- Noun
- Statistic & Mathmetics
- Algorithm