Here's a gentle guide to building JavaScript AI in web browsers. Totally not a scary thing

Google unwraps toy image rec neural net

Girl and computer, photo via Shutterstock

Google today popped online something called Teachable Machines, a simple demo for programmers interested in deep learning.

The point is, it works directly in your web browser so you can get going tinkering with an educational neural network right away without having to spin up a full machine-learning development stack and toolchain.

The demo isn’t particularly useful, but it does teach you the basics of how AI-powered image recognition works. The input data used to train the model is a series of photos from your computer’s webcam. You then give it more data, such as more snaps from the webcam, and you're rewarded with GIFs, sounds, or speech depending on the matches.

So for example, you can train the model to output a GIF of a cat if you hold up one finger, and a GIF of a dog if you hold up your hand. Then in inference mode, depending on whether you hold up a finger or a hand, you'll be shown the matching GIF. There’s a bar that shows you how confident the image recognition system is at pulling up the correct corresponding output.

It shows users the importance of training data and how image recognition models can be tricked. If the training examples are very similar to each other or you didn't feed it enough stills from the webcam, it can confuse the model and the confidence bar is low.

Teachable Machines is just an experiment, and its source code is here. What’s underneath it, powering the system, is much, much more interesting: it's deeplearn.js. Google launched deeplearn.js – an open source software library written in Javascript that runs machine learning models in web browsers – in August.

It’s a toolkit that allows novice and pro programmers build and run simple neural networks, potentially without any coding: functions selected from drop-down menus can be used to change the dataset, model type, and some hyper-parameters such as the number of layers, during development. “It won't rival state-of-the-art setups for training and running deep neural nets, [but it] can do real deep learning,” a Google spokesperson told The Register.

There is also an option to play with ImageNet, a large dataset of pictures useful for object recognition, using your webcam. You can additionally tinker with NNArt to create artwork. This uses compositional pattern-producing networks to generate the moving images. And there's a tool called Benchmarks to test how fast various standard machine-learning tasks run in browsers. Have fun. ®


Biting the hand that feeds IT © 1998–2017