Ideas for front-end machine learning features with Angular and TensorFlow.js. Two demo Angular apps using tfjs MobileNets, the Universal Sentence Encoder, and k-nearest neighbors. Talks given at St. Louis Angular Lunch and COMO DevFest 2019.
Usually used with Python, often under an abstraction layer like Keras • TensorFlow.js is the JavaScript version • npm package • Node.js or browser • Capabilities: ◦ Create models in the browser ◦ Use pre-trained models ◦ Re-train imported models • Demos
TensorFlow.js Layers: High-level API similar to Keras. • TensorFlow.js Converter: Tools to import a TensorFlow or Keras saved model • Importing @tensorflow/tfjs brings in all three ◦ Can import individually to potentially reduce bundle size • @tensorflow/tfjs works in the browser or Node.js • @tensorflow/tfjs-node: Faster Node.js version of tfjs that uses C++ bindings • @tensorflow/tfjs-node-gpu: Use Nvidia CUDA GPUs in Linux ◦ Absolute must if training large networks, e.g. convolutional neural nets (ConvNets) ◦ Not usually needed for inference • @tensorflow-models/<model-name>: Pre-made models
classifiers. Trained to detect these classes. Any browser image element => array of most likely predictions and their confidences. ~1 yr • @tensorflow-models/knn-classifier Predict what group a record belongs to based on how similar it is to others. ~1 yr • @tensorflow-models/coco-ssd Find where objects are located in an image. Supports 90 types of objects. ~1 yr • @tensorflow-models/universal-sentence-encoder Convert text into a 512-dimensional embedding. It can be used as a pre-processing step to do ML on natural language. 8 mo. • @tensorflow-models/toxicity Detect whether text contains toxic content. 7 mo.