Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Machine Learning in the Browser (Jozi.JS Feb 2019)

Machine Learning in the Browser (Jozi.JS Feb 2019)

Machine learning has earned a reputation for needing complex mathematics, gigantic datasets and expensive hardware. This has unfortunately led many developers to see machine learning as something out of their reach. I will show you how we can make use of the web browser to run prebuilt tensorflow.js models just as we would use any other JavaScript software library.

We will look at the advantages of using the web browser for doing machine learning, and how we can take advantage of something called transfer learning to tweak existing models to do some really fun things in the browser. This talk is suitable for beginners and no existing machine learning knowledge is required.

Richard Young

February 21, 2019
Tweet

More Decks by Richard Young

Other Decks in Programming

Transcript

  1. Machine learning gives computers the ability to learn without being

    explicitly programmed. - Arthur Samuel, 1959
  2. How do we teach a machine? Model Cat Cat Cat

    Cat Not a cat Train Output Input
  3. What could you use Machine Learning for? • Classifying what

    object is in an image • Location of an object in an image • Natural language processing • Recognizing and generating sounds and speech • Forecasting structured/tabular data
  4. <script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script> <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/[email protected]"></script> <img width="400px" id="img" crossOrigin src="https://upload.wikimedia.org/wikipedia/commons/6/6e/Longhair_Tabby_JaJa.jpg"> <h1

    id="description">loading...</h1> <script> const img = document.getElementById('img'); img.onload = async () => { const model = await mobilenet.load(); const predictions = await model.classify(img); const output = document.getElementById('description'); output.innerHTML = predictions[0].className } </script> …or 14 lines of HTML and JavaScript
  5. Further reading and resources Examples from this talk: https://github.com/richardyoung00/tensorflow-js-examples Tensorflow

    Pretrained Models: https://github.com/tensorflow/tfjs-models Machine Learning for Everyone: https://vas3k.com/blog/machine_learning Practical Deep Learning for Coders: https://course.fast.ai