There are three main use-cases of using tensorflow.js
Keras models are usually created via the Python API and can be saved configuration + weights, weights only, configuration only. This format can be converted to TensorFlow.js Layers format, which can be loaded directly into TensorFlow.js for inference or for further training. Learn more about converting keras model to tensorflow.js.
If you have a SavedModel of tensorflow (SavedModel contains a complete TensorFlow program, including weights and computation and it does not require the original model building code to run, which makes it useful for sharing or deploying), then you can convert it into tensorflow.js using
If you have a pre-trained model, and you want to retrain it with new data, then you can do so in tensorflow.js. This is particularly useful when you have an edge device, which you want to customise with new personalised data.
For example, you have a model which is trained by thousands of sample of voices of humans. But you want that the final model be personalised to recognise the voice of the user at the user's device. So in this scenario, you can use the pre-trained model of the voice recognition, remove the final layer and train a new (often fairly shallow) model containing the voice of user on top of the output of the truncated model.
We saw how we can use tensorflow.js to run the existing models and retrain them. But we can also use tensorflow.js to completely train the model from scratch and use it. In order to train the model from scratch, you need to be familiar with tensor-flow concepts of Tensors, Layers, Optimisers and Loss Functions.
There are few helper libraries available which can be used with tensorflow.js.
tfjs-examples contains the code and usecases developed using tensorflow.js. There are many examples available. You can find examples of Binary classification - classifying website urls as normal or phishy, reinforcement learning - using deep Q learning to solve the snake game, date conversion using LSTM attention model
One of the advantage of tensorflow.js is that it can run in browser environments. So we can easily show demos in browser, which can use text, webcam, microphone, or other things for input. Tensorflow.js contains many such interesting usecases which you can check in browser itself.