Machine Learning with TensorFlow in Javascript
Can your browser find a sweater?
These are blurry little grayscale pictures of clothing items. They are being picked at random and your browser is running them through a model that was trained with machine learning. In just a few milliseconds it makes a guess as to what is in the picture.
right out of ()
The random images are coming from a large pool of several hundred clothing images.
Admittedly, this is the same pool of images that the model was trained on, but this is only a tutorial.
If you look in the console, you'll see a little information about the model, and then the tensor output from each guess showing up every few seconds. This Tensor is the final output of the model and is basically an array of 10 numbers, each indicating how confident the model is in each potential answer. One of them should be very close to 1 white the rest should be quite small. The indexes of these numbers in the array match the indexes of the labels array. So if the first number in the array is 0.999 that means it has guessed a T-shirt/top.
I made this with sample data and guidance from the TensorFlow course at edx. It isn't particularly difficult, and it is a good way to mess around with the different parameters and learn how the tensors flow through the layers of your model.
One of the things that is impressive about TensorFlow is that it is easy to set up a model and train it on a large set of data. Then the model is saved (without the training data) and can be loaded into a webpage. That's what is happening here. The original data this model trained on was about 20MB, but the resulting model, with all its learned intelligence weighs in at only 67Kb. There's a 310 Kb TensorFlow library that runs images through the model’s layers and returns the output. If you were going to have a web page that uses the web cam to identify clothing that people were wearing, the Machine Learning model would be one of the lighter-weight downloads. The large asset download on this page is actually a data file that has the hundreds tiny images of clothing for the random tests.
My next goal is to make an AI that can play Space Traders.
You can also check out (and help train) my first Machine Learning project, Madivin.