Skip to content

Commit

Permalink
Fix (some) cases and typos =).
Browse files Browse the repository at this point in the history
  • Loading branch information
nonoesp committed Apr 8, 2018
1 parent 6af0d67 commit c21a1fc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
This is a small boilerplate project that demonstrates how to use [deeplearn.js](https://deeplearnjs.org) to create projects
like [Teachable Machine](https://teachablemachine.withgoogle.com/). The code shows how you can create setup a KNN classifier that can be trained live in the browser on a webcam image. It is intentionally kept very simple so it can provide a starting point for new projects.

Behind the scenes the image from the webcam is being processed by a small neural network called [Squeezenet](https://github.com/DeepScale/SqueezeNet). This network is trained to recognize all sorts of classes from the imagenet dataset, and is optimized to be really small, making is useable in the browser. Instead of reading the prediction values from the SqueezeNet network, we instead take the second to last layer in the neural network and feed it into a KNN ([k-nearest neighbors](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm)) classifier that allows you to train your own classes.
Behind the scenes the image from the webcam is being processed by a small neural network called [SqueezeNet](https://github.com/DeepScale/SqueezeNet). This network is trained to recognize all sorts of classes from the ImageNet dataset, and is optimized to be really small, making it useable in the browser. Instead of reading the prediction values from the SqueezeNet network, we take the second to last layer in the neural network and feed it into a KNN ([k-nearest neighbors](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm)) classifier that allows you to train your own classes.

The benefit of using the SqueezeNet model instead of feeding the pixel values directly into the KNN classifier is that we use the high level abstractions that the neural network has learned in order to recognize the Imagenet classes. This allows us with very few samples to train a classifier that can recognize things like smiles vs frown, or small movements in your body. This technique is called [Transfer Learning](https://en.wikipedia.org/wiki/Transfer_learning).
The benefit of using the SqueezeNet model instead of feeding the pixel values directly into the KNN classifier is that we use the high level abstractions that the neural network has learned in order to recognize the ImageNet classes. This allows us with very few samples to train a classifier that can recognize things like smiles vs frown, or small movements in your body. This technique is called [Transfer Learning](https://en.wikipedia.org/wiki/Transfer_learning).

Deeplearn.js has a built in model for doing this. Its called [KNN Image Classifier Model](https://github.com/PAIR-code/deeplearnjs/tree/master/models/knn_image_classifier), and this boilerplate code shows how to easily use it.
Deeplearn.js has a built in model for doing this. It's called [KNN Image Classifier Model](https://github.com/PAIR-code/deeplearnjs/tree/master/models/knn_image_classifier), and this boilerplate code shows how to easily use it.

If you are insterested in using this with [p5.js](https://p5js.org/), ITP has created a similar example that you can find [here](https://ml5js.github.io/docs/knn-image-example.html).
If you are interested in using this with [p5.js](https://p5js.org/), ITP has created a similar example that you can find [here](https://ml5js.github.io/docs/knn-image-example.html).

## Use code
To use the code, first install the javascript dependencies by running
To use the code, first install the JavaScript dependencies by running

```
npm install
```

Then start the local budo webserver by running
Then start the local budo web server by running

```
npm start
```

This will start a webserver on [`localhost:9966`](http://localhost:9966). Try and allow permission to your webcam, and add some examples by holding down the buttons.
This will start a web server on [`localhost:9966`](http://localhost:9966). Try and allow permission to your webcam, and add some examples by holding down the buttons.

## Quick Reference
A quick overview of the most important function calls in the deeplearn.js [KNN Image Classifier](https://github.com/PAIR-code/deeplearnjs/tree/master/models/knn_image_classifier)
Expand Down

0 comments on commit c21a1fc

Please sign in to comment.